Balkrishna Wagle
/
Servo_HelloWorld_Myboard
SERVO P21
Fork of Servo_HelloWorld by
main.cpp@2:6a732b645886, 2018-03-08 (annotated)
- Committer:
- rajivwagle
- Date:
- Thu Mar 08 12:24:36 2018 +0000
- Revision:
- 2:6a732b645886
- Parent:
- 1:40d2fd0b99e6
SERVO MOTOR
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 | |
rajivwagle | 2:6a732b645886 | 8 | int main() |
rajivwagle | 2:6a732b645886 | 9 | { |
rajivwagle | 2:6a732b645886 | 10 | while(1) |
rajivwagle | 2:6a732b645886 | 11 | { |
rajivwagle | 2:6a732b645886 | 12 | for(float p=0; p<1.0; p += 0.1) |
rajivwagle | 2:6a732b645886 | 13 | { |
simon | 1:40d2fd0b99e6 | 14 | myservo = p; |
simon | 1:40d2fd0b99e6 | 15 | wait(0.2); |
rajivwagle | 2:6a732b645886 | 16 | } |
rajivwagle | 2:6a732b645886 | 17 | } |
simon | 1:40d2fd0b99e6 | 18 | } |