View Full Version : Changing values from analog sensors in simulator in PICAXE programming editor

02-08-2013, 09:21 PM
Recently I have downloaded the PICAXE programming editor. There I typed the following simple program (from the PICAXE tutorial document) which switches on one L.E.D if the output from the sensor is <70, switches on another L.E.D if the output is >120; and switches both the L.E.Ds off when none of the conditions are satisfied.

main: ; make a label called ‚main
readadc C.1,b0 ; read ADC1 into variable b0
if b0 > 120 then top ; if b0 > 120 then do top
if b0 < 70 then bot ; if b0 < 70 then do bot
low B.0 ; else switch off 0
low B.4 ; and switch off 4
goto main ; jump back to the start
top: ; make a label
high B.0 ; switch on 0
low B.4 ; switch off 4
goto main ; jump back to start
bot: ; make a label
high B.4 ; switch on 4
low B.0 ; switch off 0
goto main ; jump back to start

Now when I run the simulator the following window appears. 485

If you observe it carefully you see that B4 is switched on which implies that the simulator is assuming the value from the sensor to be <70. But suppose I want that the analog sensor gives a value which is greater than 120 (this is a simulation so I must be able to change the inputs from the sensors). My question is how do I do that?

Thanks from advance.