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: mbed RC_Servo VMA306 PID CNY70 CMPS03 GP2A Pixy
Revision 18:96264a9ddaf6, committed 2019-11-01
- Comitter:
- tuk4
- Date:
- Fri Nov 01 08:30:33 2019 +0000
- Parent:
- 17:961a91037658
- Commit message:
- Committed on 1/11/2019 11:28 am
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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;