int led = 3; int brightness = 0; int fadeAmount = 2; void setup() { pinMode(led, OUTPUT);} void loop() { analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness <= 0 || brightness >= 200) {fadeAmount = -fadeAmount;} delay(10);}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter