BASIC Stamp II
PWM
Pulse-width modulate a pin for some time.
usage:
PWM pin,duty,cycles
Pin will be temporarily made an output while it is modulated.
Duty is an 8-bit value (0-255) which specifies the duty-cycle.
Cycles is the number of 256 pin update periods which take ~1ms. When
done, pin will be placed in input mode to allow the voltage to remain
until another PWM is executed.
A digital-to-analog converter can be made by connecting the pin to a
resistor which goes to a cap which goes to GND. The resistor-cap junc-
tion will reflect the duty (0-5V) during and after PWM (see below).
BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333 • Page 49
Need help?
Do you have a question about the BASIC Stamp II and is the answer not in the manual?