Lab 2 RC
Dependencies: Motor Servo mbed
main.cpp@0:7af9f9bb814c, 2015-10-13 (annotated)
- Committer:
- mattsims12
- Date:
- Tue Oct 13 04:06:07 2015 +0000
- Revision:
- 0:7af9f9bb814c
- Child:
- 1:55b6172d1930
Lab 2 RC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mattsims12 | 0:7af9f9bb814c | 1 | /*Matthew Sims |
mattsims12 | 0:7af9f9bb814c | 2 | RC Control |
mattsims12 | 0:7af9f9bb814c | 3 | Moves a servo back in forth in small incriments |
mattsims12 | 0:7af9f9bb814c | 4 | 10/13/15 |
mattsims12 | 0:7af9f9bb814c | 5 | */ |
mattsims12 | 0:7af9f9bb814c | 6 | |
mattsims12 | 0:7af9f9bb814c | 7 | #include "mbed.h" |
mattsims12 | 0:7af9f9bb814c | 8 | #include "Motor.h" |
mattsims12 | 0:7af9f9bb814c | 9 | #include "Servo.h" |
mattsims12 | 0:7af9f9bb814c | 10 | |
mattsims12 | 0:7af9f9bb814c | 11 | Servo s(p21); |
mattsims12 | 0:7af9f9bb814c | 12 | |
mattsims12 | 0:7af9f9bb814c | 13 | int main() |
mattsims12 | 0:7af9f9bb814c | 14 | { |
mattsims12 | 0:7af9f9bb814c | 15 | s.calibrate(.0009,90); |
mattsims12 | 0:7af9f9bb814c | 16 | |
mattsims12 | 0:7af9f9bb814c | 17 | while(1) { |
mattsims12 | 0:7af9f9bb814c | 18 | for(int pos=0; pos<=18; pos++) { |
mattsims12 | 0:7af9f9bb814c | 19 | s(pos/18.0); |
mattsims12 | 0:7af9f9bb814c | 20 | getchar(); |
mattsims12 | 0:7af9f9bb814c | 21 | } |
mattsims12 | 0:7af9f9bb814c | 22 | for(int pos=18; pos>=0; pos--) { |
mattsims12 | 0:7af9f9bb814c | 23 | s(pos/18.0); |
mattsims12 | 0:7af9f9bb814c | 24 | getchar(); |
mattsims12 | 0:7af9f9bb814c | 25 | } |
mattsims12 | 0:7af9f9bb814c | 26 | } |
mattsims12 | 0:7af9f9bb814c | 27 | } |