Asked — Edited
Resolved Resolved by Dunning-Kruger!

Battery Monitor

I want to set up a Battery Voltage Monitor script using the values from the EZ-B v4 Info control. Is this possible? If so, could someone please, give me some pointers to get a script started.



Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.


Can you be more specific? There is a control called EZB info that you can add to monitor the battery.


Ya, sorry. I should have explained what I want to do. I have the EZB Info control running. I am looking to create a script that would monitor the voltage and when it gets to a certain voltage, it would do something. ie, warning the voltage is low or shut down scripts that are running, etc.


There is a script command GetVoltage() that does exactly that.



You can use an if statement in a slow looping script...

$con=IsConnected(0) #check ezb voltage only when connected board 0
if($con=1) #connected to the ezb
print("EZB Volts = "+$v+"v")
if($v<6) #low battery, use any value as the V threshold
saywait("Warning, E Z B Battery is low")
#start shutting things down
sleep(10000) #wait 10 seconds between checks

United Kingdom

You can use this as a base. Remove the ADC stuff and the extra circuit etc. since it's all now within ARC/the EZ-B.

What you are left with are the IF and ElseIfs for different battery levels. Loop it with whichever method you prefer.


@Richard R, that was exactly what I was looking for, thanks. Thanks to everyone else for your input.