Canada
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.

Thanks


ARC Pro

Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!

PRO
Synthiam
#1  

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

#2  

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.

#3  

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

Alan

#4  

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



$con=1
RepeatUntil($con=0)
$con=IsConnected(0) #check ezb voltage only when connected board 0
if($con=1) #connected to the ezb
$v=GetVoltage()
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
endif
endif
sleep(10000) #wait 10 seconds between checks
EndRepeatUntil

United Kingdom
#5  

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.

#6  

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