Example to sweep a servo through its range

Dependencies:   mbed Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Hello World to sweep a servo through its full range
00002 
00003 #include "mbed.h"
00004 #include "Servo.h"
00005 
00006 Servo myservo(p21);
00007 
00008 int main() {    
00009     for(float p=0; p<1.0; p += 0.1) {
00010         myservo = p;
00011         wait(0.2);
00012     }
00013 }