joliebrise
New Member
Metronome for Tai Chi has been prototyped with 6 pole rotary switch for 6 breathing times a variable resistor for volume control.
I now want to replace the hardware with push buttons. Below is simple 08m2 circuit to test new codes C.1, 2 & 4 output leds and c.3 switch input
full details of circuits and codes for switch & VR at http://www.sailservo.co.uk/picaxe/picaxe.html#pic20
Results - C.2 comes on and stays on. Pressing the button does nothing.
; switch test start.bas, Metronome for Tai Chi
;
; 3 fixed breathing times. beat25 = 2.5sec. beat30 = 3.0sec. beat35 = 3.5sec.
;
; When b1 = 2 then beat30 is selected immediately metronome is turned on.
; Led stays on looping through until the button is pushed on or metronome turned off.
; When the button is pressed the next beat is selected, b1 = b1 + 1
; When the button is pressed during final beat it is directed back to the first beat
;
; When the programme is working "b1 = 2" will be changed to "peek 10, b1 so the user's last setting is remembered,
; sound c.0, (50,50) will be added later
init:
; peek 10, b1 added later
b1 = 2 ; changed to b1 = b1 taking value from peek
if b1 = 1 then beat25
if b1 = 2 then beat30
if b1 = 3 then beat35
main:
pinC.3 = 0 ; waiting for button to be pressed
if pinC.3 = 1 then ; button pressed
b1 = b1 + 1 ; next breath timing
endif
if b1 = 1 then beat25
if b1 = 2 then beat30
if b1 = 3 then beat35
if b1 = 4 then beat25 ; goes back to timing 1 beat25
goto main
beat25: do: b1=1 : high c.1 : pause 2106 : loop 'poke 10, 1 in front of loop added later
beat30: do: b1=2 : high c.2 : pause 2563 : loop 'poke 10, 2
beat35: do: b1=3 : high c.4 : pause 3080 : loop 'poke 10, 3
Thanks Tony
I now want to replace the hardware with push buttons. Below is simple 08m2 circuit to test new codes C.1, 2 & 4 output leds and c.3 switch input
full details of circuits and codes for switch & VR at http://www.sailservo.co.uk/picaxe/picaxe.html#pic20
Results - C.2 comes on and stays on. Pressing the button does nothing.
; switch test start.bas, Metronome for Tai Chi
;
; 3 fixed breathing times. beat25 = 2.5sec. beat30 = 3.0sec. beat35 = 3.5sec.
;
; When b1 = 2 then beat30 is selected immediately metronome is turned on.
; Led stays on looping through until the button is pushed on or metronome turned off.
; When the button is pressed the next beat is selected, b1 = b1 + 1
; When the button is pressed during final beat it is directed back to the first beat
;
; When the programme is working "b1 = 2" will be changed to "peek 10, b1 so the user's last setting is remembered,
; sound c.0, (50,50) will be added later
init:
; peek 10, b1 added later
b1 = 2 ; changed to b1 = b1 taking value from peek
if b1 = 1 then beat25
if b1 = 2 then beat30
if b1 = 3 then beat35
main:
pinC.3 = 0 ; waiting for button to be pressed
if pinC.3 = 1 then ; button pressed
b1 = b1 + 1 ; next breath timing
endif
if b1 = 1 then beat25
if b1 = 2 then beat30
if b1 = 3 then beat35
if b1 = 4 then beat25 ; goes back to timing 1 beat25
goto main
beat25: do: b1=1 : high c.1 : pause 2106 : loop 'poke 10, 1 in front of loop added later
beat30: do: b1=2 : high c.2 : pause 2563 : loop 'poke 10, 2
beat35: do: b1=3 : high c.4 : pause 3080 : loop 'poke 10, 3
Thanks Tony