Asked — Edited

Ar Drone Battery Monitor Script

Would this be correct? I want it to alert me with a beeping sound I got and it will do that at 14%(ar drone battery min and it alerts here on the ios app)



#Low Battery script

$DroneBatterymin=14

:start

IF($DroneBattery=$DroneBatterymin)
  Controlcommand("soundboard", Track_0)
ENDIF
Goto(start)


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

United Kingdom
#1  

Is $DroneBattery a global variable when using the drone? I can't see where it gets that from.

You'll also want to add in a sleep to avoid saturating the comms and adding unnecessary load on the PC. No need to check every few ms, I check my battery every 5 seconds on Melvin and that's probably a lot more often than needed.

Also, adding in a halt() after the ControlCommand() will avoid looping the audio every few ms (or however long the sleep is). Unless you want it to constantly loop the audio when the battery is low.

#3  

if I want to tell the ar drone to go up using a wii remote's 4 way button, how would I tell ARC to do this? all you can do is tell it to control servos.

PRO
Synthiam
#4  

A) you know better than to ask an unrelated question in the thread:) We already addressed your question regarding the WiiMote that was asked in it's own thread.:)

B) Your script looks good. I would also add a delay. In any language, if you loop without a delay, the CPU will be used 100% on that loop.



#Low Battery script

$DroneBatterymin=14

:start

IF( $DroneBattery <= $DroneBatterymin)

  Controlcommand("soundboard", Track_0)
  halt()
ENDIF

sleep(1000)

Goto(start)