joliebrise
New Member
One of the problems in trying to do too many code routines at once is that you do not know where are the mistakes. This situation is a case in point. The problem is pressing the button does not initiate the code change immediately. I have tried do: loop until pinC.3 = 1 and while pinC.3 = 0
It seems that “Pause” is creating a time delay.
How can I circumvent the delay and get the button to act immediately?
It seems that “Pause” is creating a time delay.
How can I circumvent the delay and get the button to act immediately?
Code:
; single push button
#picaxe 08m
b1 = 2 ; to initiate initial setup
;peek 10, b1 ; will overight b1 in previous line
pinC.3 = 0 ; switch not pressed
main:
if pinC.3 = 1 then
pause 100
let b1 = b1 + 1 ; next breath timing
endif
if b1 >6 then let b1 = 1 ; return counter to 1
endif
;poke 10, b1 ; stored for keeping data ready for next use
if b1 = 1 then beat25
if b1 = 2 then beat30
if b1 = 3 then beat35
if b1 = 4 then beat40
if b1 = 5 then beat45
if b1 = 6 then beat50
bt25: do: sound c.1, (50,50) : pause 2106 : loop while pinC.3 = 0 : goto main
bt30: do: sound c.1, (50,50) : pause 2563 : loop while pinC.3 = 0 : goto main
bt35: do: sound c.1, (50,50) : pause 3080 : loop while pinC.3 = 0 : goto main
bt40: do: sound c.1, (50,50) : pause 3554 : loop while pinC.3 = 0 : goto main
bt45: do: sound c.1, (50,50) : pause 4060 : loop while pinC.3 = 0 : goto main
bt50: do: sound c.1, (50,50) : pause 4592 : loop while pinC.3 = 0 : goto main
Attachments
-
37.4 KB Views: 17