Germany
Asked — Edited
Resolved Resolved by Steve G!

My Battery Is Low

hi there, Im working with the EZB-4 and 21x servos + a lot leds, camera and sensors.. the robot needs a lot power in action. in the same second If my robot says: "my battery is low", he collapse.. I have no time for a reaction. its not good for the optical look.. I dont want scratches.. or a broken arm.. you know. So I need to find a way to programming a better "battery is low warning". or a optical LED.. the best and coolest way is a live status inside the EZ-Robot Software..

thanks Marty


ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

United Kingdom
#10  

I'm not near a computer right now as I'm out of town and didn't bring it with me, but something like what I posted below should help...


#This script will trigger when the battery hits 6.9 volts. 
#Change the voltage to what you want it to be. 

:Loop

If($GetVoltage()<6.9)

#Enter your  ControlCommand for your  Auto Position action here. 

EndIf

Sleep(500)

GoTo(loop)

I'm not 100% sure of the syntax in the code above (maybe Rich could confirm), but it should be close enough.

EDIT. Looks like Rich beat me to it.:)

United Kingdom
#11  

The If condition needs wrapping in the brackets, you only have half in it. So

IF($voltage = 6.9)

However, a less than is better in case something drains it below 6.9 before the script spots it.

Looping the script with a sleep to constantly monitor would help. Or a waitforchange()

You don't need to assign the GetVoltage() to a variable. You can use it by itself.

See post #10:)

United Kingdom
#12  

@Rich.

Yeah, I just saw your post. Thanks for clearing that up. I changed the code above to reflect what you said. I have a hard time as it is scripting with a computer, never mind doing it from memory, lol.:P

@Smarty.

Rich has you covered on this one with the script example he posted. That will get you sorted. Just to explain, in the example, the "x" in "$x" is where you can name a variable to anything you want and use it in your scripts, but not always nessasery.:)

Germany
#13  

yahoooo! perfect :-))

thanks a lot

Germany
#14  

variable not defined in line 2.. sick

IF($voltage = 6.9) or If($GetVoltage<6.9)

is not working

United Kingdom
#15  

$voltage needs defining first.

$voltage = GetVoltage()

Or, use GetVoltage() correctly

IF(GetVoltage() &lt; 6.9)
Germany
#16  

hmm.. it says always: variable not defined for both. can you explain what you mean with: $voltage needs defining first. please for dummies:D