Jasper Denkers
/
ServoTest
A simple test program to test the Servo library.
Diff: main.cpp
- Revision:
- 0:0d481c229e21
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Oct 17 13:52:21 2010 +0000 @@ -0,0 +1,19 @@ +// Keep sweeping servo from left to right +#include "mbed.h" +#include "Servo.h" + +Servo Servo1(p20); + +int main() { + Servo1.Enable(1000,20000); + while(1) { + for (int pos = 1000; pos < 2000; pos += 25) { + Servo1.SetPosition(pos); + wait_ms(20); + } + for (int pos = 2000; pos > 1000; pos -= 25) { + Servo1.SetPosition(pos); + wait_ms(20); + } + } +} \ No newline at end of file