
asdf
main.cpp@0:2174eb6eb766, 2016-04-18 (annotated)
- Committer:
- TheDoctor822
- Date:
- Mon Apr 18 01:38:56 2016 +0000
- Revision:
- 0:2174eb6eb766
Lab 7 part 3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TheDoctor822 | 0:2174eb6eb766 | 1 | #include "mbed.h" |
TheDoctor822 | 0:2174eb6eb766 | 2 | #include "Servo.h" |
TheDoctor822 | 0:2174eb6eb766 | 3 | |
TheDoctor822 | 0:2174eb6eb766 | 4 | Serial pc(USBTX, USBRX); // tx, rx |
TheDoctor822 | 0:2174eb6eb766 | 5 | |
TheDoctor822 | 0:2174eb6eb766 | 6 | Servo myservo( p21 ); |
TheDoctor822 | 0:2174eb6eb766 | 7 | |
TheDoctor822 | 0:2174eb6eb766 | 8 | main(){ |
TheDoctor822 | 0:2174eb6eb766 | 9 | myservo.calibrate( .0009, 90 ); |
TheDoctor822 | 0:2174eb6eb766 | 10 | float i; |
TheDoctor822 | 0:2174eb6eb766 | 11 | |
TheDoctor822 | 0:2174eb6eb766 | 12 | myservo = 0; |
TheDoctor822 | 0:2174eb6eb766 | 13 | while(1){ |
TheDoctor822 | 0:2174eb6eb766 | 14 | |
TheDoctor822 | 0:2174eb6eb766 | 15 | for(i = 0; i < 1.0; i += 0.0555 ) { |
TheDoctor822 | 0:2174eb6eb766 | 16 | myservo = i; |
TheDoctor822 | 0:2174eb6eb766 | 17 | wait(.2777); |
TheDoctor822 | 0:2174eb6eb766 | 18 | } |
TheDoctor822 | 0:2174eb6eb766 | 19 | |
TheDoctor822 | 0:2174eb6eb766 | 20 | myservo = 1; |
TheDoctor822 | 0:2174eb6eb766 | 21 | for(i = 1.0; i > 0.0; i -= 0.0555 ) { |
TheDoctor822 | 0:2174eb6eb766 | 22 | myservo = i; |
TheDoctor822 | 0:2174eb6eb766 | 23 | wait(.2777); |
TheDoctor822 | 0:2174eb6eb766 | 24 | } |
TheDoctor822 | 0:2174eb6eb766 | 25 | |
TheDoctor822 | 0:2174eb6eb766 | 26 | } |
TheDoctor822 | 0:2174eb6eb766 | 27 | |
TheDoctor822 | 0:2174eb6eb766 | 28 | } |