Need help on BASIC Language.
bbnqond
Posts: 16
Dear all,
I am currently work on a project using BS2P24 and I would like to seek help here.
I want to doing something like this:
I have connected an active low button to P8 of the stamp. When I press the button, go subroutine A; when i press the button again, stop A and go subroutine B. (Eg, When I press the button, the LED lit; when I press the button again, the LED turns off.)
I have thought of using the Button function, yet I failed to do so. The program succeed in going to subrountine A but failed to return to subrountine B when I pressed the button again. Below shows what I have written:
===========================
led PIN 9
but PIN 8
butWrk VAR Byte
Main:
BUTTON but, 0, 255, btnWrk, 0, B
DEBUG "flame on!"
HIGH 9
B:
LOW 9
DEBUG "Bye~"
============================
Could any big guy help me out?
Regards,
bbnqond
I am currently work on a project using BS2P24 and I would like to seek help here.
I want to doing something like this:
I have connected an active low button to P8 of the stamp. When I press the button, go subroutine A; when i press the button again, stop A and go subroutine B. (Eg, When I press the button, the LED lit; when I press the button again, the LED turns off.)
I have thought of using the Button function, yet I failed to do so. The program succeed in going to subrountine A but failed to return to subrountine B when I pressed the button again. Below shows what I have written:
===========================
led PIN 9
but PIN 8
butWrk VAR Byte
Main:
BUTTON but, 0, 255, btnWrk, 0, B
DEBUG "flame on!"
HIGH 9
B:
LOW 9
DEBUG "Bye~"
============================
Could any big guy help me out?
Regards,
bbnqond
Comments
Main:
Do
-Check button
Loop
Subroutine A
Do
-Check button
Loop
Subroutine B
GOTO Main
This checks the button constantly until it's pushed, then does subA. It then checks the button until push again, and does subB. It then returns to main (begining) and begins checking again. It's a big loop.
Thz bro, I got the concept now
I wonder if it is possible to read the state of the pin using INPUT..@@?
IF(pin0 = 1)THEN
Debug "pin 0 = 1"
IF(pin0 = 0)THEN
Debug "pin 0= 0"
Thz