5: BASIC Stamp Command Reference – NAP
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 193
Demo Program (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} 'STAMP directive (specifies a BS2)
LOW 0 ' Turn LED on.
Snooze:
NAP 4 ' Nap for 288 ms.
GOTO Snooze
2
2
2
470
Ω
LED
Figure 5.16: Example LED Circuit.
NOTE: This is written for the BS2
but can be used for the BS1, BS2e,
BS2sx and BS2p also. Locate the
proper source code file or modify
the STAMP directive before
downloading to the BS1, BS2e,
BS2sx or BS2p.