StampWorks Experiment #4
lockadoc
Posts: 115
··· I am trying to modify the program to work with 11 LEDS instead if the 8 and at the same time controll a servo to follow the LEDS . I just got the Professional Development Board and don't have the full grasp of writing programs yet.
··· I would like some help pointing me in the right direction.
·································· THanks Bill
··· I would like some help pointing me in the right direction.
·································· THanks Bill
Comments
Now that I got it working with 11LEDS , I noticed and every third pass it would not light up LED #8. Is it becuase of the DelayTm being changed or trouble elsewhere?
Here is the code that I'm using.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Program Description ]
'
' "Modified
'Ping-Pongs" a single LED back-and-forth across a bank of eight. This
' program will work, unmodified, on any BS2-family module.
'
[noparse][[/noparse] I/O Definitions ]
LEDs VAR OUTS ' LEDs on P0 - P10
LEDsDirs VAR DIRS ' DIRS control for LEDs
'
[noparse][[/noparse] Constants ]
DelayTm CON 75 ' delay time for lit LED
'
[noparse][[/noparse] Initialization ]
Reset:
LEDS = %00000000001 ' start with right LED on
LEDsDirs = %11111111111 ' make LEDs outputs
'
[noparse][[/noparse] Program Code ]
Main:
REVERSE 8
DO WHILE (LEDs < %10000000000) ' test for left extreme
PAUSE DelayTm ' on-time for lit LED
LEDs = LEDs << 1 ' shift LED left
LOOP
DO
PAUSE DelayTm
LEDs = LEDs >> 1 ' shift LEDs right
LOOP UNTIL (LEDs = %000000000001) ' test for right extreme
GOTO Main
THanks.... BIll