andres castaño
/
servo
u
Diff: main.cpp
- Revision:
- 0:8793e3992715
diff -r 000000000000 -r 8793e3992715 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Aug 25 16:25:26 2020 +0000 @@ -0,0 +1,20 @@ + #include "mbed.h" + #include "Servo.h" + + Servo Servo1(A5); +int main(){ + Servo1.Enable(1500,20000); + + while(1) { + wait(5); + for (int pos = 1000; pos < 2000; pos += 25) { + + Servo1.SetPosition(pos); + wait_ms(20); + }wait(5); + for (int pos = 2000; pos > 1000; pos -= 25) { + Servo1.SetPosition(pos); + wait_ms(20); + } + } + } \ No newline at end of file