ESE350 project, Spring 2016, University of Pennsylvania
Dependencies: Adafruit9-DOf Receiver mbed-rtos mbed
Diff: main.cpp
- Revision:
- 5:f007542f1dab
- Parent:
- 4:3040d0f9e8c6
- Child:
- 6:6f3ffd97d808
diff -r 3040d0f9e8c6 -r f007542f1dab main.cpp --- a/main.cpp Fri Apr 01 18:55:21 2016 +0000 +++ b/main.cpp Sat Apr 02 12:40:04 2016 +0000 @@ -15,7 +15,7 @@ // pwm outputs for the 4 motors PwmOut motor_1(p21); -PwmOut motor_2(p23); +PwmOut motor_2(p22); PwmOut motor_3(p23); PwmOut motor_4(p24); @@ -71,9 +71,6 @@ pc.printf("Entering control loop\n\r"); while (1) { - - - /* Calculate pitch and roll from the raw accelerometer data */ accel.getEvent(&accel_event); if (dof.accelGetOrientation(&accel_event, &orientation)) { @@ -99,7 +96,7 @@ gyro_event.gyro.y -= offset_gyro.y_offset; gyro_event.gyro.z -= offset_gyro.z_offset; - wait(0.1); + wait(0.01); // get sensor values @@ -114,8 +111,9 @@ // Set duty cycle // continue looking what pwm is. - motor_2=50+result.M_x; - motor_4=50-result.M_x; + + motor_2=0.6+result.M_x/100; + motor_4=0.6-result.M_x/100; // plot