Throw and Go
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
In this code we just throw the drone and the drone will take off after that we can control the drone for the flight
// Do not remove the include below
#include "PlutoPilot.h"
#include "Sensor.h"
#include "Utils.h"
#include "User.h"
#include "Motor.h"
//The setup function is called once at Pluto's hardware startup
void plutoInit()
{
// Add your hardware initialization code here
}
//The function is called once before plutoLoop when you activate Developer Mode
void onLoopStart()
{
// do your one time stuff here
}
// The loop function is called in an endless loop
void plutoLoop()
{
int Acceleration1 = Acceleration.getNetAcc();
Monitor.println("Net Acceleration is: ", Acceleration1);
if (Acceleration1==2 && ! FlightStatus.check(FS_CRASHED))
{
Motor.set(M5,1500);
Motor.set(M6,1500);
Motor.set(M7,1500);
Motor.set(M8,1500);
Monitor.println("Drone is armed");
}
}
//The function is called once after plutoLoop when you deactivate Developer Mode
void onLoopFinish()
{
Motor.set(M5,1000);
Motor.set(M6,1000);
Motor.set(M7,1000);
Motor.set(M8,1000);
// do your cleanup stuffs here
}