Beginner need help with programing SX/B
Projsx
Posts: 4
I am a beginner in the programing enviorment and very much interested in the SX/B
I need assistance to write SX basic code to allow a TTL button to have the following function
Press once = 1 then hold till ·Press again = 0 then hold till. ·repeat the process. This function will be similar to a flip flop ckt.
Tks.
I need assistance to write SX basic code to allow a TTL button to have the following function
Press once = 1 then hold till ·Press again = 0 then hold till. ·repeat the process. This function will be similar to a flip flop ckt.
Tks.
Comments
How do you have the button connected ?
Bean.
status··· VAR··· Bit
Main:
· IF RA.0 = 0 THEN Main
· status = status XOR 1
· PAUSE 50
· GOTO Main
Note that this is a partial listing just to show you the guts of your request.· The PAUSE is inserted to debounce the button a bit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Below is an explanation of the project.
This project consist of two buttons Button A and Button B
Press button A once to turn a light ON, Press button A again to turn a light OFF
Input button RB4 ( TTL +5v/0v)
Output RB5 driving the base of a transistor which in turn control a relay that turn a light ON or OFF
Press button B once to turn a motor ON, Press button B again turn a motor OFF
Input button RB5 ( TTL+5v/0v)
Output RB6 driving the base of a transistor which in turn control a relay that turn a motor ON of OFF
Tks Projsx
Buton B input RB6
Output RB7
Tks.
Projsx
· TOGGLE RB.5
· PAUSE 50
Button1Down:
· IF RB.4 = 0 THEN Button1Down
Button1Up:
· IF RB.6 = 1 THEN Button2Up
· TOGGLE RB.7
· PAUSE 50
Button2Down:
· IF RB.6 = 0 THEN Button2Down
Button2Up:
Bean.
The program is now working great.
Can't wait to start another program with SXB.
Thanks again.
Projsx