Jasper Denkers
/
ServoTest
A simple test program to test the Servo library.
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 // Keep sweeping servo from left to right 00002 #include "mbed.h" 00003 #include "Servo.h" 00004 00005 Servo Servo1(p20); 00006 00007 int main() { 00008 Servo1.Enable(1000,20000); 00009 while(1) { 00010 for (int pos = 1000; pos < 2000; pos += 25) { 00011 Servo1.SetPosition(pos); 00012 wait_ms(20); 00013 } 00014 for (int pos = 2000; pos > 1000; pos -= 25) { 00015 Servo1.SetPosition(pos); 00016 wait_ms(20); 00017 } 00018 } 00019 }
Generated on Tue Jul 12 2022 12:33:03 by 1.7.2