Hi
I have written this programme to control the indicators by push buttons on the steering wheel of my kitcar, but I have a small problem that I have been unable to solve, if indicating right or left when the hazards activated the programme returns to indicate when the hazards are cancelled.
Also I would appriciate any comments on my programme (but please keep it simple).
sorry and thankyou
I have written this programme to control the indicators by push buttons on the steering wheel of my kitcar, but I have a small problem that I have been unable to solve, if indicating right or left when the hazards activated the programme returns to indicate when the hazards are cancelled.
Also I would appriciate any comments on my programme (but please keep it simple).
Code:
'MK indicators + hazards + sound & nc switches.
main:
let b2 = 0
let b3 = 0
setint %00000000,%00110000 'enable the interrupt
button c.5,1,255,0,b2,0,prc_RIGHT
button c.4,1,255,0,b3,0,prc_LEFT
let b0 = 0
let b1 = 0
goto main
prc_RIGHT: 'right indicator
high 1
pause 500 'Wait command
low 1
pause 500
do while pinC.4 = 1 and pinC.5 = 1 ' repeat
let b0 = b0 + 1 'Inc command
high 1
pause 300 'Wait command
low 1
pause 250 'Wait command
sound 6,(90,10)
if b0 >= 12 then main: 'Compare command
loop 'End of repeat loop
low 1,2
wait 2 'Wait command
goto main
prc_LEFT: 'left indicator
high 2 'set output 2 on
pause 500 'Wait command
low 2
pause 500
do while pinC.4 = 1 and pinC.5 = 1 ' repeat
let b1 = b1 + 1 'Inc command
high 2 'set output 2 on
pause 300 'Wait command
low 2
pause 250
sound 6,(106,10)
if b1 >= 12 then main: 'Compare inputs
loop 'End of repeat loop
low 1,2
wait 2 'Wait command
goto main
interrupt: 'Hazards
high 1,2
pause 400 'Wait command
low 1,2
pause 400
do while pinC.4 = 1 and pinC.5 = 1 ' repeat
high 1,2
pause 400 'Wait command
low 1,2
sound 6,(90,10,100,20)
loop 'End of repeat loop
wait 2
low 1,2 'Wait command
return
#no_data 'reduce download time
Last edited: