Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo
Diff: guardian.cpp
- Revision:
- 12:7eeb29892625
- Parent:
- 7:e005cfaff8d1
--- a/guardian.cpp Fri Jan 31 19:36:28 2014 +0000
+++ b/guardian.cpp Sat Feb 01 00:03:40 2014 +0000
@@ -1,43 +1,29 @@
#include "guardian.h"
-Guardian::Guardian(PinName ailpin, PinName modpin, PinName elvpin, PinName rudpin, PinName auxpin, PinName gainpin)
+Guardian::Guardian(PinName modpin, PinName gainpin)
+:mod(modpin),
+gain(gainpin)
{
- ail=new Servo(ailpin);
- mod=new Servo(modpin);
- elv=new Servo(elvpin);
- /*rud=new Servo(rudpin);
- aux=new Servo(auxpin);
- */
- gain=new Servo(gainpin);
- mod->write(0.5); //set autopilot to off
- ail->write(0.5);
- elv->write(0.5);
- /*rud->write(0.5);
- aux->write(0.00);
- */
- gain->write(1.00);
-}
-Guardian::~Guardian()
-{
- delete ail, mod, elv, rud, aux, gain;
+ mod.write(0.5); //set autopilot to off
+ gain.write(1.00);
}
void Guardian::set3D() //set autopilot to 3D
{
- mod->write(1.00);
+ mod.write(1.00);
return;
}
void Guardian::set2D() //set autopilot 2D
{
- mod->write(0.00);
+ mod.write(0.00);
return;
}
void Guardian::setoff()
{
- mod->write(0.5);
+ mod.write(0.5);
return;
}
@@ -53,32 +39,14 @@
return;
}
-void Guardian::setail(float val)
-{
- ail->write(val);
- return;
-}
-
void Guardian::setmod(float val)
{
- mod->write(val);
+ mod.write(val);
return;
}
-void Guardian::setelv(float val)
-{
- elv->write(val);
- return;
-}
-
-void Guardian::setrud(float val)
+void Guardian::setgain(float val)
{
- rud->write(val);
- return;
-}
-
-void Guardian::setaux(float val)
-{
- aux->write(val);
+ gain.write(val);
return;
}
\ No newline at end of file