Lab 2 RC
Dependencies: Motor Servo mbed
Diff: main.cpp
- Revision:
- 1:55b6172d1930
- Parent:
- 0:7af9f9bb814c
- Child:
- 2:26ae66987e9f
--- a/main.cpp Tue Oct 13 04:06:07 2015 +0000 +++ b/main.cpp Tue Oct 13 04:11:33 2015 +0000 @@ -4,22 +4,22 @@ 10/13/15 */ -#include "mbed.h" +#include "mbed.h" //include libraries #include "Motor.h" #include "Servo.h" -Servo s(p21); +Servo s(p21); //Initiate servo int main() { - s.calibrate(.0009,90); + s.calibrate(.0009,90); //Calibrate servo while(1) { - for(int pos=0; pos<=18; pos++) { - s(pos/18.0); - getchar(); + for(int pos=0; pos<=18; pos++) { //Moves 18 positions + s(pos/18.0); //Moves 1/18 of the distance + getchar(); //Wait for button press } - for(int pos=18; pos>=0; pos--) { + for(int pos=18; pos>=0; pos--) { //Same as last loop, but backwards s(pos/18.0); getchar(); }