// déclaration des moteurs

 

#define moteur_left OUT_A

#define moteur_right OUT_C

 

// déclaration des capteurs

 

#define contact1 SENSOR_1

#define contact3 SENSOR_3

 

task main() {

     SetSensor (contact1, SENSOR_TOUCH);

     SetSensor (contact3, SENSOR_TOUCH);

     start action;

}

    

task action() {

 

     while (true)

           {

                 OnRev (moteur_left);

                 OnRev (moteur_right);

                 if (contact3 != 1)

                        {

                              OnFwd (moteur_right);

                              OnFwd (moteur_left);

                              Wait(100);

                              Off(moteur_right);

                              OnRev (moteur_left);

                              Wait(100);

                        }

                 if (contact1 != 1)

                        {

                              OnFwd (moteur_right);

                              OnFwd (moteur_left);

                              Wait(100);

                              Off(moteur_left);

                              OnRev (moteur_right);

                              Wait(100);

                        }

           }

}