Hi,
New to picaxe and trying my best to learn the code, but I would like some help solving this code issue please.
I have code working in the simulator, but when I try it on the chip it stops parallel tasking.
The objective is:
Press the button, pot value is read and LED0 then lights for pot period and goes out. At the same time in the second task when the button is pressed LED1 lights for 5 seconds and then goes out.
This all works in the simulator, but when on the chip, LED1 lights for its 5 seconds, but LED0 only lights for a fixed minimum time period regardless of the pot value.
Any idea's what the issue is or suggestions for alternative code, any help would be most appreciated.
Code:
08M2
SYMBOL LED1 = 0
SYMBOL LED2 = 1
SYMBOL POT1 = 4
SYMBOL TRIGGER = pin3
SYMBOL Temp = B1
START0:
ReadADC POT1, Time
IF TRIGGER = 1 THEN START0:
HIGH LED1
FOR TEMP = 1 TO Time
PAUSE 1
NEXT TEMP
LOW LED1
GOTO START0:
START1:
IF TRIGGER = 0 THEN HIGH LED2
PAUSE 5000
LOW LED2
ENDIF
GOTO START1:
New to picaxe and trying my best to learn the code, but I would like some help solving this code issue please.
I have code working in the simulator, but when I try it on the chip it stops parallel tasking.
The objective is:
Press the button, pot value is read and LED0 then lights for pot period and goes out. At the same time in the second task when the button is pressed LED1 lights for 5 seconds and then goes out.
This all works in the simulator, but when on the chip, LED1 lights for its 5 seconds, but LED0 only lights for a fixed minimum time period regardless of the pot value.
Any idea's what the issue is or suggestions for alternative code, any help would be most appreciated.
Code:
08M2
SYMBOL LED1 = 0
SYMBOL LED2 = 1
SYMBOL POT1 = 4
SYMBOL TRIGGER = pin3
SYMBOL Temp = B1
START0:
ReadADC POT1, Time
IF TRIGGER = 1 THEN START0:
HIGH LED1
FOR TEMP = 1 TO Time
PAUSE 1
NEXT TEMP
LOW LED1
GOTO START0:
START1:
IF TRIGGER = 0 THEN HIGH LED2
PAUSE 5000
LOW LED2
ENDIF
GOTO START1: