Connect an LED and 470 Ω resistor as shown below for the demo program.
' PULSOUT.BS1
' This program blinks an LED on for 25 ms at 1-second intervals. Connect an
' LED (active-low) to I/O pin 0.
' {$STAMP BS1}
' {$PBASIC 1.0}
Setup:
HIGH 0 ' make P0 high (LED off)
Main:
PULSOUT 0, 2500 ' flash LED for 25 ms
PAUSE 1000 ' one second delay
GOTO Main
END
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.
' PULSOUT.BS2
' This program blinks an LED on for 25 ms at 1-second intervals. Connect an
' LED (active-low) to I/O pin 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
Scale CON 500 ' to ms for 2 us per unit
#CASE BS2SX, BS2P, BS2PX
Scale CON 1250 ' to ms for 0.8 us per unit
#ENDSELECT
Flash CON 25 * Scale ' 25 milliseconds
Setup:
HIGH 0 ' make P0 high (LED off)
Main:
PULSOUT 0, Flash ' flash LED
PAUSE 1000 ' one second delay
GOTO Main
END
BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.
8/8/2012