Simulator issue
Re-checked your post and tried a couple of things:
First stepped to the readadc line and then changed the value in the w3 box. Value is reset to 0 after executing the readadc line.
Then after my line - symbol battery_value = w3, I put let w3 = 76. This set the value of w3 which was then reset to 0 after the readadc line was executed.
Then thinking the 0 in the readadc command was a problem I tried changing the readadc line to readadc 1, battery_value, but no difference.
Something wrong with my code, with the value of w3 being set to 0, but what?
'Things to do
'move messages to pre-defined in LCD to save memory
'tune turning to mow next strip ie one motor only to turn or turn onto compass bearing
'brake cutter motor
'Mower program for 28x
'Inputs
'Input 0 is ADC for battery voltage
symbol perimeter_collision_sensor =pin1
symbol tilt_sensor =pin2
symbol bump_sensor =pin3
symbol wet_sensor = pin6
symbol docked_sensor = pin7
'Outputs
symbol cutter_motor = 0
symbol right_motor_drive =1
symbol left_motor_drive = 2
symbol run_LED =5
symbol piezo_sounder = 6
'output 7 is serial comms with LCD
'Variables and constants
symbol full_charge = w1
Let full_charge =100 ' set battery threshold voltage for fully charged
symbol battery_value = w3
symbol running_flag =b12
'random number for turning =w4
'Check machine status and if Ok goto start sequence
Status:
pause 500 'init LCD
serout 7,N2400,(254,1) 'clear LCD
pause 30 'allow LCD to clear
serout 7,N2400,(254,128) 'move cursor to start of first line
serout 7,N2400, ("Checking Status ")
readadc10 0,battery_value 'read battery voltage
serout 7,N2400,(254,192) 'move cursor to start of second line
serout 7,N2400, (#battery_value," Volts")
if docked_sensor =1 then feed
If perimeter_collision_sensor = 1 and battery_value <300 then home
if perimeter_collision_sensor = 1 then reverse_direction
if tilt_sensor =1 then alarm
if wet_sensor =1 then home
if running_flag =0 then start 'if not already running goto start
random w4 'generate randon number
debug
sound piezo_sounder,(100,50) 'setup intermittent beep
goto status 'continue to monitor status
'Shutdown machine, wait and check status
Shutdown:
Low cutter_motor 'shutdown cutter
' would be better to brake cutter motor!
serout 7,N2400,(254,1) 'clear LCD
pause 30 'allow LCD to clear
serout 7,N2400,(254,128) 'move cursor to start of first line
serout 7,N2400, ("Stopping ")
Pulsout Right_Motor_drive,150 'stop (low outputs doesn't stop!) speed change on MD22 operates on next pulse
Pulsout Left_Motor_Drive,150
readadc10 0,battery_value 'read battery voltage
Pause 5000 'wait for complete shutdown
low run_LED 'turn off running lamp
Let running_flag=0 'flag start is required
sound piezo_sounder, (120,500)'signal stopped
serout 7,N2400,(254,1) 'clear LCD
pause 30 'allow LCD to clear
serout 7,N2400,(254,128) 'move cursor to start of first line
serout 7,N2400, ("Waiting for 10 mins")
'put countdown here
sleep 260 'wait 10 mins then check if reason for shutdown has gone
Goto status