Frank Girald
/
Servo
Servo Motor
Fork of Servo_HelloWorld by
main.cpp@1:40d2fd0b99e6, 2010-11-23 (annotated)
- Committer:
- simon
- Date:
- Tue Nov 23 16:10:35 2010 +0000
- Revision:
- 1:40d2fd0b99e6
- Parent:
- 0:ea7182628dfa
- Child:
- 2:115ddb84b970
Hello World version including library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 1:40d2fd0b99e6 | 1 | // Hello World to sweep a servo through its full range |
simon | 1:40d2fd0b99e6 | 2 | |
simon | 1:40d2fd0b99e6 | 3 | #include "mbed.h" |
simon | 1:40d2fd0b99e6 | 4 | #include "Servo.h" |
simon | 1:40d2fd0b99e6 | 5 | |
simon | 1:40d2fd0b99e6 | 6 | Servo myservo(p21); |
simon | 1:40d2fd0b99e6 | 7 | |
simon | 1:40d2fd0b99e6 | 8 | int main() { |
simon | 1:40d2fd0b99e6 | 9 | for(float p=0; p<1.0; p += 0.1) { |
simon | 1:40d2fd0b99e6 | 10 | myservo = p; |
simon | 1:40d2fd0b99e6 | 11 | wait(0.2); |
simon | 1:40d2fd0b99e6 | 12 | } |
simon | 1:40d2fd0b99e6 | 13 | } |