PE 5.12.0 / 262144
Working on this problem for mshorter and found strange behaviour in the simulator;
When stepping through the code with the simulator, the first time the editor is run on the first pass all seems OK but on the second pass, immediately the readadc command is stpped through, output 2 goes high. This is the same regarless of which adc is set for read i.e. readadc 0, 1, or 2!
The same thing seems to happen if the read adc line is remmed out and b1 is is set manually within the simulator.
Also readadc does not produce a value - my memory says that in earlier versions of the editor, a readadc line in the simulator returned a mid range value or am I dreaming?
Working on this problem for mshorter and found strange behaviour in the simulator;
Code:
#picaxe 18X
main:
'Sound
readadc 2,b1
'sertxd ("Sound (b1) - ",#b1,cr,lf)
'LEDs
readoutputs b0
If bit0 = 1 then 'Check if pump 1 is on
b2 = b1 - 100 * 2
EndIf
'Pumps
select case b1
case <110 'OFF
pins = %00000000
case 110 to 130 'Pump 1
pins = %00000001
pwmout 3,255,b2
case 131 to 160 'Pump 2
pins = %00000011
pwmout 3,255,b2
case 161 to 190 'Pump 3
pins = %00000111
pwmout 3,255,b2
Else 'Pump 4 b1 >189
pins = %00010111 'Leds pwm on pin3
pwmout 3,255,b2
EndSelect
goto main
The same thing seems to happen if the read adc line is remmed out and b1 is is set manually within the simulator.
Also readadc does not produce a value - my memory says that in earlier versions of the editor, a readadc line in the simulator returned a mid range value or am I dreaming?
Last edited: