PWM - BASIC Stamp Command Reference
Demo Program (PWM.bs2)
' Connect a voltmeter (such as a digital multimeter set to its voltage range) to the output of
' the circuit shown in the figure for the PWM command (in the manual). Run the program
' and observe the readings on the meter. They should come very close to 1.96V, then
' decrease slightly as the capacitor discharges. Try varying the interval between PWM
' bursts (by changing the PAUSE value) and the number of PWM cycles to see their effect.
'{$STAMP BS2}
Again:
PWM 0, 100, 40
PAUSE 1000
GOTO Again
Page 250 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
'STAMP directive (specifies a BS2)
' 40 cycles of PWM at 100/255 duty
' Wait a second.
' Repeat
2
2
2
1
2
e
p
sx
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 and the Cycles
value of PWM before downloading
to the BS1, BS2e, BS2sx or BS2p.
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?