Fixed Sonar
Dependencies: C12832 Servo mbed-rtos-edited mbed
Fork of NervousPuppy by
Revision 7:8b2cf5e6e888, committed 2015-01-28
- Comitter:
- SeanDoyle
- Date:
- Wed Jan 28 16:49:16 2015 +0000
- Parent:
- 6:f854aa2f41e2
- Commit message:
- tracking implemented
Changed in this revision
Servo.lib | Show annotated file Show diff for this revision Revisions of this file |
nervousPuppy.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f854aa2f41e2 -r 8b2cf5e6e888 Servo.lib --- a/Servo.lib Mon Jan 26 14:50:41 2015 +0000 +++ b/Servo.lib Wed Jan 28 16:49:16 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/simon/code/Servo/#36b69a7ced07 +http://developer.mbed.org/users/jdenkers/code/Servo/#352133517ccc
diff -r f854aa2f41e2 -r 8b2cf5e6e888 nervousPuppy.cpp --- a/nervousPuppy.cpp Mon Jan 26 14:50:41 2015 +0000 +++ b/nervousPuppy.cpp Wed Jan 28 16:49:16 2015 +0000 @@ -9,16 +9,18 @@ AnalogIn ainLeft(p15); AnalogIn ainRight(p16); -C12832 lcd(p5, p7, -p6, p8, p11); +C12832 lcd(p5, p7, p6, p8, p11); nervousPuppy::nervousPuppy(){ rotation = 0; + int pos = 1000; + rotate.Enable(1000,20000); while(1){ + - float x = ainRight.read(); - float y = ainLeft.read(); + float x = 100*ainRight.read(); + float y = 100*ainLeft.read(); lcd.cls(); @@ -27,14 +29,16 @@ 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); + if(y > 3.5 && x < 3.5){ + lcd.printf("rotating by ,%f",pos); + pos += 50; + rotate.SetPosition(pos); + }else if(x > 3.5 && y < 3.5){ + lcd.printf("rotating by ,%f", pos); + pos -= 50; + rotate.SetPosition(pos); } - wait(0.2); + } }