the fish that looks like a jet

Dependencies:   ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo

Committer:
sandwich
Date:
Fri Jan 24 21:55:00 2014 +0000
Revision:
2:430c068cf570
Child:
5:090ef6275773
all parts working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sandwich 2:430c068cf570 1 #include "guardian.h"
sandwich 2:430c068cf570 2
sandwich 2:430c068cf570 3 Guardian::Guardian(PinName ailpin, PinName modpin, PinName elvpin, PinName rudpin, PinName auxpin, PinName gainpin)
sandwich 2:430c068cf570 4 {
sandwich 2:430c068cf570 5 ail=new Servo(ailpin);
sandwich 2:430c068cf570 6 mod=new Servo(modpin);
sandwich 2:430c068cf570 7 elv=new Servo(elvpin);
sandwich 2:430c068cf570 8 /*rud=new Servo(rudpin);
sandwich 2:430c068cf570 9 aux=new Servo(auxpin);
sandwich 2:430c068cf570 10 */
sandwich 2:430c068cf570 11 gain=new Servo(gainpin);
sandwich 2:430c068cf570 12 mod->write(0.5);
sandwich 2:430c068cf570 13 ail->write(0.5);
sandwich 2:430c068cf570 14 elv->write(0.5);
sandwich 2:430c068cf570 15 /*rud->write(0.5);
sandwich 2:430c068cf570 16 aux->write(0.00);
sandwich 2:430c068cf570 17 */
sandwich 2:430c068cf570 18 gain->write(1.00);
sandwich 2:430c068cf570 19 }
sandwich 2:430c068cf570 20
sandwich 2:430c068cf570 21 Guardian::~Guardian()
sandwich 2:430c068cf570 22 {
sandwich 2:430c068cf570 23 delete ail, mod, elv, rud, aux, gain;
sandwich 2:430c068cf570 24 }
sandwich 2:430c068cf570 25
sandwich 2:430c068cf570 26 void Guardian::set3D()
sandwich 2:430c068cf570 27 {
sandwich 2:430c068cf570 28 mod->write(1.00);
sandwich 2:430c068cf570 29 return;
sandwich 2:430c068cf570 30 }
sandwich 2:430c068cf570 31
sandwich 2:430c068cf570 32 void Guardian::set2D()
sandwich 2:430c068cf570 33 {
sandwich 2:430c068cf570 34 mod->write(0.00);
sandwich 2:430c068cf570 35 return;
sandwich 2:430c068cf570 36 }
sandwich 2:430c068cf570 37
sandwich 2:430c068cf570 38 void Guardian::setoff()
sandwich 2:430c068cf570 39 {
sandwich 2:430c068cf570 40 mod->write(0.5);
sandwich 2:430c068cf570 41 return;
sandwich 2:430c068cf570 42 }
sandwich 2:430c068cf570 43
sandwich 2:430c068cf570 44 void Guardian::calibrate() //must be done within 15 sec of power on
sandwich 2:430c068cf570 45 {
sandwich 2:430c068cf570 46 set2D();
sandwich 2:430c068cf570 47 wait(500);
sandwich 2:430c068cf570 48 set3D();
sandwich 2:430c068cf570 49 wait(500);
sandwich 2:430c068cf570 50 set2D();
sandwich 2:430c068cf570 51 wait(2000);
sandwich 2:430c068cf570 52 //now look for the twitch
sandwich 2:430c068cf570 53 return;
sandwich 2:430c068cf570 54 }
sandwich 2:430c068cf570 55
sandwich 2:430c068cf570 56 void Guardian::setail(float val)
sandwich 2:430c068cf570 57 {
sandwich 2:430c068cf570 58 ail->write(val);
sandwich 2:430c068cf570 59 return;
sandwich 2:430c068cf570 60 }
sandwich 2:430c068cf570 61
sandwich 2:430c068cf570 62 void Guardian::setmod(float val)
sandwich 2:430c068cf570 63 {
sandwich 2:430c068cf570 64 mod->write(val);
sandwich 2:430c068cf570 65 return;
sandwich 2:430c068cf570 66 }
sandwich 2:430c068cf570 67
sandwich 2:430c068cf570 68 void Guardian::setelv(float val)
sandwich 2:430c068cf570 69 {
sandwich 2:430c068cf570 70 elv->write(val);
sandwich 2:430c068cf570 71 return;
sandwich 2:430c068cf570 72 }
sandwich 2:430c068cf570 73
sandwich 2:430c068cf570 74 void Guardian::setrud(float val)
sandwich 2:430c068cf570 75 {
sandwich 2:430c068cf570 76 rud->write(val);
sandwich 2:430c068cf570 77 return;
sandwich 2:430c068cf570 78 }
sandwich 2:430c068cf570 79
sandwich 2:430c068cf570 80 void Guardian::setaux(float val)
sandwich 2:430c068cf570 81 {
sandwich 2:430c068cf570 82 aux->write(val);
sandwich 2:430c068cf570 83 return;
sandwich 2:430c068cf570 84 }