Connect an LED and 470 Ω resistor as shown below for the demo program.
NOTE: The example below is written for the BS2 and will run on any of the BS2-family modules. Modify the $STAMP directive (as required) before downloading to the BS2e, BS2sx, BS2p, BS2pe, or BS2px.
' NAP.BS2 ' The program below lights an LED by placing a low on pin 0. This completes ' the circuit from +5V, through the LED and resistor, to ground. During the ' NAP interval, the LED stays lit, but blinks off for a fraction of a second. ' This blink is caused by the NAP wakeup mechanism. During wakeup, all pins ' briefly slip into input mode, effectively disconnecting them from loads. ' {$STAMP BS2} Setup: LOW 0 ' turn LED on Snooze: NAP 4 ' nap for 288 ms GOTO Snooze END
BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.
8/8/2012