encounters with electron•ics / by flabbergast

Variable light (Arduino sketch)


Control the light intensity of a LED diode by the length of a button press: if just clicked, then turn it on all the way; if held for a longer time, slowly change the intensity up and down. Releasing just keeps the current intensity.

The sketch: variable_light.ino

The Fritzing diagram: variable_light.fzz