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.
Diff: main.cpp
- Revision:
- 24:731f8fbc4adb
- Parent:
- 23:f87e7472befe
- Child:
- 25:f986cbbaf4e8
--- a/main.cpp Sun May 03 11:51:56 2020 +0000
+++ b/main.cpp Sun May 03 12:29:38 2020 +0000
@@ -54,8 +54,8 @@
int main() {
int iState=Depart;
- int distObsGauche=pot1.read();
- int distObsDroite=pot2.read();
+ float distObsGauche=pot1.read();
+ float distObsDroite=pot2.read();
int SwitchBumpers=bumpers.read();
int SwitchUp=up.read();
int SwitchJack=jack.read();
@@ -100,7 +100,7 @@
break;
}//switch
- while(iState==Depart)
+ if(iState==Depart)
{
if(SwitchJack==0||SwitchFire==1)
iState=Navigation;
@@ -108,7 +108,7 @@
iState=Arrive;
}
- while(iState==Navigation)
+ if(iState==Navigation)
{
if(distObsGauche>20||distObsDroite>20)
iState=Rotation;
@@ -118,13 +118,13 @@
iState=Arrive;
}
- while(iState==Arrive)
+ if(iState==Arrive)
{
if(SwitchUp==1)
iState=Depart;
}
- while(iState==Evitement)
+ if(iState==Evitement)
{
if(distObsGauche<20||distObsDroite<20)
iState=Rotation;
@@ -134,7 +134,7 @@
iState=Arrive;
}
- while(iState==Rotation)
+ if(iState==Rotation)
{
if(distObsGauche>40&&distObsDroite>40)
iState=Navigation;