You guys must think i am well thick. I just dont get it. I think i am getting the hang of it so i read up and try somthing and it dose not work. BooHoo.
I Now have a problem with button code.
So why does the example code work when it is all set to 0
What is the relevance of B2 as it dose not change in the simulator.
I have written this code
and it works mor or less the same but both codes only work once.
If the button is pressed a second time the cycle stops on the button code line instead of jumping to cont.
What i want to do is make b1 cycle 0,1,2,3,0,1,2,3,etc every time the button is pressed so i can write a code that says somthing like if b1 = 1 then or if b1 = 2 then and so on
What am i missing or am i to thick to realise i am thick
Thanks again
Joe
I Now have a problem with button code.
If understand what the manuel above says downstate should be 1 when the button is pressed and targetstate should be 1 when the button is pressed.BUTTON pin,downstate,delay,rate,bytevariable,targetstate,address
- Pin is a variable/constant (0-7) which specifies the i/o pin to use.
- Downstate is a variable/constant (0 or 1) which specifies what logical state is
read when the button is pressed.
- Delay is a variable/constant (0-255) which specifies time before a repeat if
BUTTON is used within a loop.
- Rate is a variable/constant (0-255) which specifies the auto-repeat rate in
BUTTON cycles.
- Bytevariable is the workspace. It must be cleared to 0 before being used by
BUTTON for the first time.
- Targetstate is a variable/constant (0 or 1) which specifies what state (0=not
pressed, 1=pressed) the button should be in for a branch to occur.
- Address is a label which specifies where to go if the button is in the target
state.
So why does the example code work when it is all set to 0
Code:
main: button 0,0,200,100,b2,0,cont
‘ jump to cont unless pin0 = 0
toggle 1 ‘ else toggle input
goto main
cont:
b1=b1+1
goto main
I have written this code
Code:
main: button 0,1,50,50,b0,1,cont
goto main
cont:
b1=b1+1
goto main
If the button is pressed a second time the cycle stops on the button code line instead of jumping to cont.
What i want to do is make b1 cycle 0,1,2,3,0,1,2,3,etc every time the button is pressed so i can write a code that says somthing like if b1 = 1 then or if b1 = 2 then and so on
What am i missing or am i to thick to realise i am thick
Thanks again
Joe