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:
- 22:64fa6f501426
- Parent:
- 21:39815fb7e4f5
- Child:
- 23:f87e7472befe
--- a/main.cpp Sun May 03 11:37:39 2020 +0000
+++ b/main.cpp Sun May 03 11:48:52 2020 +0000
@@ -56,10 +56,10 @@
int iState=Depart;
int distObsGauche=pot1.read();
int distObsDroite=pot2.read();
- int bumpers=bumpers.read();
- int up=up.read();
- int jack=jack.read();
- int fire=fire.read();
+ int SwitchBumpers=bumpers.read();
+ int SwitchUp=up.read();
+ int SwitchJack=jack.read();
+ int SwitchFire=fire.read();
lcd.cls();
lcd.locate(32,16);
lcd.printf("Module ER2 : template");
@@ -82,63 +82,63 @@
break;
case Evitement :
LED_rouge.write(1);
- if(distObsDroite>distObsGsuche)
- comandeMoteur(100,0);
+ if(distObsDroite>distObsGauche)
+ commandeMoteurs(100,0);
//printf.lcd("Evitement1");
else
- commandeMoteur(0,100);
+ commandeMoteurs(0,100);
//printf.lcd("Evitement2");
break;
case Rotation :
LED_rouge.write(!LED_rouge.read());
- if(distObsDroite>distObsGsuche)
- comandeMoteur(100,0);
+ if(distObsDroite>distObsGauche)
+ commandeMoteurs(100,0);
//printf.lcd("Rotation1");
else
- commandeMoteur(0,100);
+ commandeMoteurs(0,100);
//printf.lcd("Rotation2");
break;
}//switch
while(iState=Depart)
{
- if(jack==0||fire==1)
+ if(SwitchJack==0||SwitchFire==1)
iState=Navigation;
- if(up==1)
+ if(SwitchUp==1)
iState=Arrive;
}
while(iState=Navigation)
{
- if(//distObsGauche>20cm||distObsDroite>20cm)
+ if(distObsGauche>20||distObsDroite>20)
iState=Rotation;
- if(//20cm<distObsGauche<40cm&&20cm<distObsDroite<0cm)
- iState=Evitation;
- if(/*white tested*/||bumpers==1)
+ if(20<distObsGauche<40&&20<distObsDroite<40)
+ iState=Evitement;
+ if(/*white tested||*/SwitchBumpers==1)
iState=Arrive;
}
while(iState=Arrivee)
{
- if(up==1)
+ if(SwitchUp==1)
iState=Depart;
}
while(iState=Evitement)
{
- if(//distObsGauche<20cm||distObsDroite<20cm)
+ if(distObsGauche<20||distObsDroite<20)
iState=Rotation;
- if(//distObsGauche>40cm&&distObsDroite>40cm)
+ if(distObsGauche>40&&distObsDroite>40)
iState=Navigation;
- if(/*white tested*/||bumpers==1)
+ if(/*white tested||*/SwitchBumpers==1)
iState=Arrive;
}
while(iState=Rotation)
{
- if(//distObsGauche>40cm&&distObsDroite>40cm)
+ if(distObsGauche>40&&distObsDroite>40)
iState=Navigation;
- if(/*white tested*/||bumpers==1)
+ if(/*white tested||*/SwitchBumpers==1)
iState=Evitement;
}