Use of the BUTTON command
hijker
Posts: 10
I can't get the BUTTON command working the way I want.
What I have is 2 buttons named UP and Down.
When I press one of them a counter should count up or down.
When I fast press or use auto repeat the counter should also in/decrease.
This works so far.
But when I stop pressing the program must check the value in the counter and process it.
This part does not work.
As soon as I press the button the prog always enters this check.
Main:
BUTTON Down, 0,400, 20, ButVal, 0, NextBut
DisVal = DisVal - 1·· 'Decrease Counter
GOTO Main
NextBut:
BUTTON Up, 0,400, 20, ButVal, 0, No_Press
DisVal = DisVal + 1· 'Increase Counter
GOTO Main
No_Press:···· ' It should come here only when a button is NOT pressed after some time.· But it comes here even after 1 press and the next (fast) press is ignored.
.
.
.
IF RN = DisVal THEN Hoofd
'*
IF DisVal = 1 THEN r1
What I have is 2 buttons named UP and Down.
When I press one of them a counter should count up or down.
When I fast press or use auto repeat the counter should also in/decrease.
This works so far.
But when I stop pressing the program must check the value in the counter and process it.
This part does not work.
As soon as I press the button the prog always enters this check.
Main:
BUTTON Down, 0,400, 20, ButVal, 0, NextBut
DisVal = DisVal - 1·· 'Decrease Counter
GOTO Main
NextBut:
BUTTON Up, 0,400, 20, ButVal, 0, No_Press
DisVal = DisVal + 1· 'Increase Counter
GOTO Main
No_Press:···· ' It should come here only when a button is NOT pressed after some time.· But it comes here even after 1 press and the next (fast) press is ignored.
.
.
.
IF RN = DisVal THEN Hoofd
'*
IF DisVal = 1 THEN r1
Comments
As far as I'm aware, EACH Button command should have it's OWN workarea ("ButVal"). Try that and see what happens.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
All I want is press a button, maybe once or maybe more than once.
After the button(s) are quiet for some time then I want process the changes.
·
I· want to use the Button command to keep looking to see if it PIN·gose ·low and run·ONE·routine then when it see the pin gose HIGH then run the SECOND·routine i doing a project where i will running the BS2 on battery some of the time and some of the time AC power
How would i do this
I·am sorry if i have HIJACK this Post i did not mean to this but this person was asking this·and this will be something that i will be doing very
soon
Thank for any help that you can give in this matter
Sam