Another Newbie question
NWCCTV
Posts: 3,629
Is it possible to have a BS2SX chip leave 2 LED's on while running other processes, or would I be better off using the Peopeller to accomplish this?
Comments
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
DO
· HIGH 13
· PAUSE 500
· LOW 13
· PAUSE 500
LOOP
So this will alternately on/off an LED every half second. So if you don't turn the LED off (by sending a low to pin 13) it will stay on as long as you like.
Just put the on/off code anywhere you want in your code, like...
'Main Loop
DO
· GOSUB Turn_Them_On
· GOSUB Do_Stuff
· GOSUB Do_Other_Stuff
· GOSUB Turn_Them_Off
LOOP
Turn_Them_On:
· HIGH 12
· HIGH 13
RETURN
Turn_Them_Off:
· LOW 12
· LOW 13
RETURN
Output ports when put to HIGH or LOW remain in that state until changed by the program, so you can "go somewhere else" and do just about anything. If your LEDs are turned on or off at specific times, just place the appropriate subroutine call in your code where it needs to be.
I used subroutines above to illustrate that the program can continue once the LEDs are lit or extinguished, but you could just as easily put:
HIGH 12
HIGH13
...or...
LOW 12
LOW 13
...anywhere you need to in your code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard Vannoy
Programming and Electronics Instructor
www.RichardVannoy.info
·
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
If you move a servo and then stop paying attention to it, weird things will happen, but if you turn an LED on and then stop paying attention to it, it´ll just stay on. No problem.