// the setup function runs once when you press reset or power the board int led=7; int brightness = 0; float frequency = 0.5;//Hz int i=0; const float pi = 3.141593; float rad_step=20; void setup() { // initialize digital pin "led" as an output. pinMode(led, OUTPUT); } // the loop function runs over and over again forever void loop() { analogWrite(led, brightness); // turn the LED on (HIGH is the voltage level) // change the brightness sinusoidally for next time through the loop: brightness=int(127*sin(i*2*pi/rad_step)+127);//frequency/(2*pi)* i=i+1; delay(1000/frequency/rad_step); }