![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ESE350 project, Spring 2016, University of Pennsylvania
Dependencies: Adafruit9-DOf Receiver mbed-rtos mbed
Diff: main.cpp
- Revision:
- 9:f1bd96708a21
- Parent:
- 7:f3f94eadc5b5
- Child:
- 10:e7d1801e966a
diff -r 326e7009ce0c -r f1bd96708a21 main.cpp --- a/main.cpp Sat Apr 02 13:47:58 2016 +0000 +++ b/main.cpp Sat Apr 02 14:54:46 2016 +0000 @@ -14,7 +14,7 @@ Adafruit_L3GD20_Unified gyro = Adafruit_L3GD20_Unified(20); Serial pc(USBTX, USBRX); - +Serial *pcPntr=&pc; // pwm outputs for the 4 motors (motor 1 points into x direction, 2 into y direction, 3 -x direction, -y direction PwmOut motor_1(p21); @@ -35,9 +35,11 @@ int main() { - Quadcopter *myQuadcopter; // initialze Quadcopter object - - control result; + Quadcopter myQuadcopter; // initialze Quadcopter object + myQuadcopter.setSerial(pcPntr); // give Quadcopter object pc Pointer in order to print + myQuadcopter.initAllSensors(); // initialize sensors + + control result; offset offset_gyro; initSensors(accel, mag, gyro,offset_gyro); @@ -117,10 +119,10 @@ // assumption for low angles the computed moments are between -10...10 // since I dont want to risk, i set PWM to 60% duty cycle if deflection =10. // USB connection of quadcopter points into x direction. - - + + // Set duty cycle - // continue looking what pwm is. + // continue looking what pwm is. motor_2=0.6+result.M_x/100; motor_4=0.6-result.M_x/100;