David Buck
/
calibrate_esc
main.cpp@0:9f66525c89d7, 2010-01-27 (annotated)
- Committer:
- Kaikestu
- Date:
- Wed Jan 27 11:55:24 2010 +0000
- Revision:
- 0:9f66525c89d7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kaikestu | 0:9f66525c89d7 | 1 | #include "mbed.h" |
Kaikestu | 0:9f66525c89d7 | 2 | #include "Servo.h" |
Kaikestu | 0:9f66525c89d7 | 3 | |
Kaikestu | 0:9f66525c89d7 | 4 | DigitalOut myled(LED2); |
Kaikestu | 0:9f66525c89d7 | 5 | Servo motor (p21); |
Kaikestu | 0:9f66525c89d7 | 6 | |
Kaikestu | 0:9f66525c89d7 | 7 | int main() { |
Kaikestu | 0:9f66525c89d7 | 8 | |
Kaikestu | 0:9f66525c89d7 | 9 | int b = 0; |
Kaikestu | 0:9f66525c89d7 | 10 | |
Kaikestu | 0:9f66525c89d7 | 11 | while (b !=2 ){ |
Kaikestu | 0:9f66525c89d7 | 12 | |
Kaikestu | 0:9f66525c89d7 | 13 | motor.write(0.5); |
Kaikestu | 0:9f66525c89d7 | 14 | wait(3); |
Kaikestu | 0:9f66525c89d7 | 15 | |
Kaikestu | 0:9f66525c89d7 | 16 | motor.write(0); //full forward |
Kaikestu | 0:9f66525c89d7 | 17 | wait(1); |
Kaikestu | 0:9f66525c89d7 | 18 | motor.write(0.5); |
Kaikestu | 0:9f66525c89d7 | 19 | wait(1); |
Kaikestu | 0:9f66525c89d7 | 20 | myled = 1; |
Kaikestu | 0:9f66525c89d7 | 21 | |
Kaikestu | 0:9f66525c89d7 | 22 | wait(2); |
Kaikestu | 0:9f66525c89d7 | 23 | |
Kaikestu | 0:9f66525c89d7 | 24 | motor.write(0.88); //full bacward |
Kaikestu | 0:9f66525c89d7 | 25 | wait(5); |
Kaikestu | 0:9f66525c89d7 | 26 | motor.write(0.5); |
Kaikestu | 0:9f66525c89d7 | 27 | wait(1); |
Kaikestu | 0:9f66525c89d7 | 28 | myled = 0; |
Kaikestu | 0:9f66525c89d7 | 29 | |
Kaikestu | 0:9f66525c89d7 | 30 | b = 2; |
Kaikestu | 0:9f66525c89d7 | 31 | } |
Kaikestu | 0:9f66525c89d7 | 32 | |
Kaikestu | 0:9f66525c89d7 | 33 | while(1) {//FIN |
Kaikestu | 0:9f66525c89d7 | 34 | myled = 1; |
Kaikestu | 0:9f66525c89d7 | 35 | wait(0.2); |
Kaikestu | 0:9f66525c89d7 | 36 | myled = 0; |
Kaikestu | 0:9f66525c89d7 | 37 | wait(0.2); |
Kaikestu | 0:9f66525c89d7 | 38 | } |
Kaikestu | 0:9f66525c89d7 | 39 | } |