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

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

United Kingdom
#17  

In the example...

GetVoltage() Returns the EZ-B v4 Battery Voltage Example: $x = GetVoltage()

In the $x part, the x is replaced with "voltage". This equals to the GetVoltage variable. So basicly your giving the "GetVoltage" variable the name "Voltage" which is called upon within the script. This is defining the variable. But as Rich said, this is not needed as $GetVoltage is already an existing variable code so you can simply use this without having to define a variable.

#18  

Smarty, This is what I use. You can add commands you want.

$voltage=GetVoltage() print($voltage) $cputemp=GetCPUtemp() print($cputemp) if (GetVoltage() < 7.0) say("EZB voltage now less than 7 volts") endif

if (GetVoltage() <= 6.7) say("My EZB positronic brain voltage is " + $voltage + " volts, temperature is " + $cputemp + "degrees C") say("Steve, Voltage is now dangerously low, starting automatic shutdown soon, which may result in a neuralnet failure because I will lose the ability to send serial commands to my IRobot drive system. ") endif if (GetVoltage() > 6.7) Say(" I am operating within normal parameters, Thank you father for asking ") say("My EZB positronic brain voltage is " + $voltage + " volts, temperature is " + $cputemp + "degrees C") Say("Steve hope you are doing ok on this " + $dayname + " in " + $monthname ) sleep(1500)

endif

United Kingdom
#19  

So this won't work for you?...

$voltage=GetVoltage()
:loop
If($voltage&lt;6.9)
#Your command code for auto position
Endif
Sleep(500)
GoTo(loop)
#20  

Minor error in Rich's code. $getvoltage() is not a system variable, it is a command which retreives a value..

code should be:


if (getvoltage() &lt; 6.9)
#do something
endif

(with the loops and sleeps etc....)

Alan

United Kingdom
#21  

Alan spotted my deliberate mistake;)

Edited post to reflect this.

#22  

heh... lessons for the students..

Alan

Germany
#23  

@Steve G I misunderstood.


$voltage=GetVoltage()
:loop
If($voltage&lt;6.9)

is working fine :-) thanks I thought I have to use $voltage=GetVoltage() or If($voltage<6.9):D:D:D

@Steve S thanks for the script, really cool :-)