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.
Dependencies: C12832 Servo mbed-rtos-edited mbed
Fork of NervousPuppySprintOne by
nervousPuppy.cpp
- Committer:
- SeanDoyle
- Date:
- 2015-01-26
- Revision:
- 6:f854aa2f41e2
- Parent:
- 5:cbb5d7460309
- Child:
- 7:8b2cf5e6e888
File content as of revision 6:f854aa2f41e2:
#include "nervousPuppy.h"
/**
* Constructor - contains running loop
*/
Servo tilt(p21);
Servo rotate(p22);
AnalogIn ainLeft(p15);
AnalogIn ainRight(p16);
C12832 lcd(p5, p7,
p6, p8, p11);
nervousPuppy::nervousPuppy(){
rotation = 0;
while(1){
float x = ainRight.read();
float y = ainLeft.read();
lcd.cls();
lcd.locate(0,3);
lcd.printf("x = %f",x);
lcd.printf(" y = %f",y);
if(x > 0.10 && y < 0.10){
lcd.printf("rotating by 2");
rotate.calibrate(0.0005,2);
}else if(y > 0.10 && x < 0.10){
lcd.printf("rotating by -2");
rotate.calibrate(0.0005,-2);
}
wait(0.2);
}
}
int main(){
nervousPuppy();
}
