![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tuk workshop
Dependencies: mbed RC_Servo VMA306 PID CNY70 CMPS03 GP2A Pixy
Diff: main.cpp
- Revision:
- 18:96264a9ddaf6
- Parent:
- 17:961a91037658
diff -r 961a91037658 -r 96264a9ddaf6 main.cpp --- a/main.cpp Thu Oct 31 16:13:21 2019 +0000 +++ b/main.cpp Fri Nov 01 08:30:33 2019 +0000 @@ -51,6 +51,7 @@ motor.setintegralValue(0.4); motor.setDerivativeValue(1.0); double speed_L = -200, speed_R = -200; + bool reset = false; while (1) { motor.getPosition(&x, &y, &theta); @@ -83,10 +84,12 @@ if (ultraSon.readUSB() <= 20) { current_state = SAFEMODE; } - if (left_center.whatAmIOn()== 0) + if (left_center.whatAmIOn()== 0 && reset == false) { led1==1; motor.resetPosition(); + reset = true; + } if (x<=-1300) current_state = STUPID1; break;