Oskar Weigl
/
Quadcopterv2
This is for ICRS\' second generation Quadcopter
Diff: motors.h
- Revision:
- 0:0bbf2f16da9c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/motors.h Fri Nov 18 18:23:33 2011 +0000 @@ -0,0 +1,52 @@ + +void initmotor() { + PWMleft.period_ms(20); + PWMleft = NOPOWER; + PWMright.period_ms(20); + PWMright = NOPOWER; + + PWMfront.period_ms(20); + PWMfront = NOPOWER; + PWMrear.period_ms(20); + PWMrear = NOPOWER; +} + +void leftM(float thrust) { + float output = (542 + 0.462 * thrust) / 10000; + if (output > 0.0950) { + PWMleft = 0.0950; + motormaxled = 1; + } else { + PWMleft = output; + } +} + +void rightM(float thrust) { + float output = (542 + 0.462 * thrust) / 10000; + if (output > 0.0950) { + PWMright = 0.0950; + motormaxled = 1; + } else { + PWMright = output; + } +} + +void frontM(float thrust) { + float output = (542 + 0.462 * thrust) / 10000; + if (output > 0.950) { + PWMfront = 0.0950; + motormaxled = 1; + } else { + PWMfront = output; + } +} + +void rearM(float thrust) { + float output = (542 + 0.462 * thrust) / 10000; + if (output > 0.0950) { + PWMrear = 0.0950; + motormaxled = 1; + } else { + PWMrear = output; + } +}