Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:1808ad33273a, 2014-10-15 (annotated)
- Committer:
- jkangwi
- Date:
- Wed Oct 15 19:03:49 2014 +0000
- Revision:
- 0:1808ad33273a
- Child:
- 1:023abab124e7
test servo code
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jkangwi | 0:1808ad33273a | 1 | #include "mbed.h" |
jkangwi | 0:1808ad33273a | 2 | #include "Servo.h" |
jkangwi | 0:1808ad33273a | 3 | |
jkangwi | 0:1808ad33273a | 4 | |
jkangwi | 0:1808ad33273a | 5 | |
jkangwi | 0:1808ad33273a | 6 | Servo myservo1(p21); |
jkangwi | 0:1808ad33273a | 7 | Servo myservo2(p22); |
jkangwi | 0:1808ad33273a | 8 | |
jkangwi | 0:1808ad33273a | 9 | int main() |
jkangwi | 0:1808ad33273a | 10 | { |
jkangwi | 0:1808ad33273a | 11 | |
jkangwi | 0:1808ad33273a | 12 | float servopos; |
jkangwi | 0:1808ad33273a | 13 | for(servopos=0; servopos<=1.0; servopos+=0.1) { |
jkangwi | 0:1808ad33273a | 14 | myservo1=servopos; |
jkangwi | 0:1808ad33273a | 15 | myservo2=1.0-servopos; |
jkangwi | 0:1808ad33273a | 16 | printf("Servo 1 position %.2f Servo 2 position %.2f\n\r", servopos, (1-servopos)); |
jkangwi | 0:1808ad33273a | 17 | getchar(); |
jkangwi | 0:1808ad33273a | 18 | } |
jkangwi | 0:1808ad33273a | 19 | } |