Data Sheet

Project 18
LED Brightness Button
Build the circuit and load sketch LED_Brightness_Button into
Snapino
TM
using the programming instructions in project 3. Push the
press switch (S2) repeatedly; the red LED (D1) gets brighter each time.
After the red LED reaches full brightness then it resets and starts over.
Programming Note:
The red LED brightness is set using the
analogWrite
() command, which uses values from
0 to 255, but incremental increases will be much
more noticeable between low numbers than
between high numbers. Because of this, this sketch
uses an array to set the red LED brightness in
multiples of 2, then resets back to minimum.
-28-
SCSNAPINO_Manual_112816.qxp 12/30/16 2:00 PM Page 29