pierre masala
/
Servo
nmbbghgj
Fork of Servo by
main.cpp@2:49ad86fca628, 2017-12-06 (annotated)
- Committer:
- pierre11
- Date:
- Wed Dec 06 16:51:21 2017 +0000
- Revision:
- 2:49ad86fca628
- Child:
- 3:9640475cdfbe
yes;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pierre11 | 2:49ad86fca628 | 1 | #include "mbed.h" |
pierre11 | 2:49ad86fca628 | 2 | #include "Servo.h" |
pierre11 | 2:49ad86fca628 | 3 | int main(int argc, char* argv[]) |
pierre11 | 2:49ad86fca628 | 4 | { |
pierre11 | 2:49ad86fca628 | 5 | Servo Servo1(PD_13); |
pierre11 | 2:49ad86fca628 | 6 | |
pierre11 | 2:49ad86fca628 | 7 | Servo1.Enable(1500,20000); |
pierre11 | 2:49ad86fca628 | 8 | |
pierre11 | 2:49ad86fca628 | 9 | while(1) { |
pierre11 | 2:49ad86fca628 | 10 | for (int pos = 1000; pos < 2000; pos += 25) |
pierre11 | 2:49ad86fca628 | 11 | { |
pierre11 | 2:49ad86fca628 | 12 | Servo1.SetPosition(pos); |
pierre11 | 2:49ad86fca628 | 13 | wait_ms(20); |
pierre11 | 2:49ad86fca628 | 14 | } |
pierre11 | 2:49ad86fca628 | 15 | for (int pos = 2000; pos > 1000; pos -= 25) { |
pierre11 | 2:49ad86fca628 | 16 | Servo1.SetPosition(pos); |
pierre11 | 2:49ad86fca628 | 17 | wait_ms(20); |
pierre11 | 2:49ad86fca628 | 18 | } |
pierre11 | 2:49ad86fca628 | 19 | } |
pierre11 | 2:49ad86fca628 | 20 | return 0; |
pierre11 | 2:49ad86fca628 | 21 | } |