Created
December 19, 2011 09:06
-
-
Save Aluriak/1496202 to your computer and use it in GitHub Desktop.
NXC : Lessive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
#define Port_Tactile IN_1 | |
#define Port_Telemetre IN_2 | |
#define Port_Microphone IN_3 | |
//*/ | |
void setup() | |
{ | |
SetSensorTouch(IN_1); | |
SetSensorSound(IN_2); | |
SetSensorLowspeed(IN_4); | |
} | |
task main() | |
{ | |
setup(); | |
until(Sensor(IN_2) > 60); | |
OnFwd(OUT_BC, 100); | |
//* | |
until(Sensor(IN_4) < 20) | |
OnFwd(OUT_BC, 25); | |
until(Sensor(IN_1) == true); | |
Off(OUT_BC); | |
Wait(1000); | |
RotateMotor(OUT_BC, 25, -360); | |
RotateMotorEx(OUT_BC, 25, 540, -100, true, false); | |
//*/ | |
} | |
/* | |
1. Attendre que le micro détecte un son fort; | |
2. Faire avancer le robot à pleine puissance ; | |
3. Attendre un obstacle à moins de 20 cm ; | |
4. Se rapprocher de l’obstacle à vitesse réduite; | |
5. Attendre que le capteur tactile soit actionné; | |
6. Arrêter les moteurs immédiatement ; | |
7. Attendre une seconde (temporisation); | |
8. Reculer doucement sur 10cm environ ; | |
9. Faire un quart de tour sur place; | |
//*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment