![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Very early flyable code.
Diff: motors.h
- Revision:
- 0:9fcb3bf5c231
diff -r 000000000000 -r 9fcb3bf5c231 motors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/motors.h Sat Oct 01 12:57:23 2011 +0000 @@ -0,0 +1,56 @@ + +void initmotor() { + PWMleft.period_ms(20); + PWMleft = 0.01; + PWMright.period_ms(20); + PWMright = 0.01; + + PWMfront.period_ms(20); + PWMfront = 0.01; + PWMrear.period_ms(20); + PWMrear = 0.01; +} + +bool leftM(float thrust) { + float output = (634 + 0.657 * thrust) / 10000; + if (output > 0.0910) { + PWMleft = 0.0910; + return true; + } else { + PWMleft = output; + return false; + } +} + +bool rightM(float thrust) { + float output = (617 + 0.474 * thrust) / 10000; + if (output > 0.0822) { + PWMright = 0.0822; + return true; + } else { + PWMright = output; + return false; + } +} + +bool frontM(float thrust) { + float output = (637 + 0.509 * thrust) / 10000; + if (output > 0.0880) { + PWMfront = 0.0800; + return true; + } else { + PWMfront = output; + return false; + } +} + +bool rearM(float thrust) { + float output = (644 + 0.470 * thrust) / 10000; + if (output > 0.0908) { + PWMrear = 0.0908; + return true; + } else { + PWMrear = output; + return false; + } +} \ No newline at end of file