//Code en nxc pour le pare-choc sur table //Code en msi2, Clovis Gravel #define avance 300 #define virage 250 #define recule 1500 #define power 75 mutex moveMutex; task move_avant() { while (true) { Acquire(moveMutex); OnFwd(OUT_BC,75);Wait(300); Release(moveMutex); } } task check_sensors() { while (true) { if (SENSOR_1==1) { Acquire(moveMutex); OnRev(OUT_BC,75);Wait(300); OnFwd(OUT_B,power);Wait(250); { Release(moveMutex); } } if (SENSOR_2==1) { Acquire(moveMutex); OnRev(OUT_BC,75);Wait(300); OnFwd(OUT_C,power);(virage); { Release(moveMutex); } } } task main() { Precedes(move_avant, check_sensors SetSensorTouch(IN_1); SetSensorTouch(IN_2); }