Singapore
Asked — Edited

Help Prevent Jf Faceplanting

Hi all,

When my JD decides that his battery level is low, he lurches forward from a standing position and does a spectacular faceplant on my desk or floor!

To prevent the poor guy cracking his face, I was hoping to script an early warning system that would advise me when he was approaching critical level so I could at least lay him down flat first.

If I recall correctly, the battery warning cuts in at around 6.6 volts so I wrote this small code snippet which runs after connection to alert me when the voltage dipped below 7 volts.


:loop
$batteryLevel=GetVoltage() 
if ($batteryLevel < 7)
ControlCommand("Soundboard v4", Track_12) 
endif 
sleep( 60000 )
Goto (loop)

Track 12 is an audio file that advises 'Energy Cell Exhausted' (I know many of you will guess where that came from:) ).

Whilst the script works, it is not reliably firing off before JD complains his battery level is low and does his faceplant thing.

Can anyone suggest a better method of achieving an early warning alert?

Thanks.


ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.