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/Task4.cpp
- Revision:
- 19:bd88749c8db4
- Parent:
- 14:267368c83b6a
- Child:
- 21:b642c18eccd1
--- a/RTOS-Threads/src/Task4.cpp Sat May 03 02:05:51 2014 +0000
+++ b/RTOS-Threads/src/Task4.cpp Sat May 03 02:11:41 2014 +0000
@@ -18,7 +18,11 @@
ESCpower[1] = (RCCommand[3]*9/10) + (pitch_adjust / 2) + (roll_adjust / 2) - (yaw_adjust / 2);
ESCpower[2] = (RCCommand[3]*9/10) - (pitch_adjust / 2) + (roll_adjust / 2) + (yaw_adjust / 2);
ESCpower[3] = (RCCommand[3]*9/10) - (pitch_adjust / 2) - (roll_adjust / 2) - (yaw_adjust / 2);
+
+ for (int i = 0; i < 4; i++)
+ ESC[i] = constrainESC(ESC[i]);
+ // if (ESC_check)
//BT.printf("%4d %4d %4d %4d\n", ESCpower[0], ESCpower[1], ESCpower[2], ESCpower[3]);
for (int i = 0; i < 4; i++)
@@ -39,4 +43,14 @@
}
//LED[4] = !LED[4];
-}
\ No newline at end of file
+}
+
+int constrainESC(int input)
+{
+ if (input < 1000)
+ return 1000;
+ else if (input > 2000)
+ return 2000;
+ else
+ return input;
+}