Slide 22
Slide 22 text
klab.ca
analogWrite() for analog outputs
• Analog output pins: 3, 5, 6, 9, 10, 11
• pinMode( pin#, OUTPUT );
Setting pinMode() not necessary for analog -- but won’t hurt.
• analogWrite( pin#, dutyCycle );
Output to a pin a duty cycle between 0 (always
off) and 255 (always on).
• Goal: Light up external LilyPad LEDs on pin 5 and 6 at brightness
steps between 0 and 255
Solution: 03.Analog > DimExternalLEDs