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.
Diff: RTOS-Threads/src/Task2.cpp
- Revision:
- 3:605fbcb54e75
- Parent:
- 2:ab967d7b4346
- Child:
- 5:4879ef0e6d41
diff -r ab967d7b4346 -r 605fbcb54e75 RTOS-Threads/src/Task2.cpp --- a/RTOS-Threads/src/Task2.cpp Tue Apr 29 11:43:32 2014 +0000 +++ b/RTOS-Threads/src/Task2.cpp Tue Apr 29 14:53:32 2014 +0000 @@ -2,10 +2,32 @@ #include "Task2.h" #include "setup.h" +#include "PID.h" + +int yaw_adjust = 0; +int pitch_adjust = 0; +int roll_adjust = 0; + +int16_t gx, gy, gz; void Task2(void const *argument) { + yawPIDrate.setSetPoint(RCCommand[0]); + pitchPIDrate.setSetPoint(RCCommand[1]); + rollPIDrate.setSetPoint(RCCommand[2]); + imu.getRotation(&gx, &gy, &gz); + gx /= 32.8; + gy /= 32.8; + gz /= 32.8; + + yawPIDrate.setProcessValue(gz); + pitchPIDrate.setProcessValue(gy); + rollPIDrate.setProcessValue(gz); + + yaw_adjust = yawPIDrate.compute(); + pitch_adjust = pitchPIDrate.compute(); + roll_adjust = rollPIDrate.compute(); //LED[2] = !LED[2]; } \ No newline at end of file