
if (valG==HIGH){ if (valC==HIGH){ if(valD==HIGH){advance(50,50);}else{advance(0,0);/*vald==LOW dans ce cas*/} }else{turn_R(0,0);/*valC==LOW dans ce cas*/} }else(advance(0,0)/*valG==LOW dans ce cas*/;
Posté 23 février 2010 - 06:55
if (valG==HIGH){ if (valC==HIGH){ if(valD==HIGH){advance(50,50);}else{advance(0,0);/*vald==LOW dans ce cas*/} }else{turn_R(0,0);/*valC==LOW dans ce cas*/} }else(advance(0,0)/*valG==LOW dans ce cas*/;
Posté 23 février 2010 - 09:11
Posté 23 février 2010 - 10:47
Posté 24 février 2010 - 12:04
Posté 24 février 2010 - 12:39
Posté 24 février 2010 - 12:42
Posté 24 février 2010 - 11:18
int inputPinG = 8; int inputPinC = 9; int inputPinD = 10; int valG = 0; int valC = 0; int valD = 0; int E1 = 5; //M1 vitesse int E2 = 6; //M2 vitesse int M1 = 4; //M1 Direction int M2 = 7; //M1 Direction void advance(char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //avancer { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void back_off (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //reculer { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void turn_L (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à gauche { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void turn_R (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à droite { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void setup(void) { int i; for(i=5;i<=8;i++) pinMode(i, OUTPUT); pinMode(inputPinG, INPUT); // declare Infrared sensor as input pinMode(inputPinC, INPUT); // declare Infrared sensor as input pinMode(inputPinD, INPUT); // declare Infrared sensor as input Serial.begin(19200); //Set Baud Rate } void loop () { while (Serial.available()) { switch (Serial.read()) { case 'j': valG = digitalRead(inputPinG); valC = digitalRead(inputPinC); valD = digitalRead(inputPinD); if (valG&&valC&&valD==HIGH){advance(50,50);} else if (valG==LOW){advance(150,80);} else if (valC==LOW){turn_R(100,100);} else if (valC==LOW){advance(80,150);} break; case 'z'://avancer advance (100,100); //réglage vitesse break; case 'w'://reculer back_off (100,100); break; case 'q'://virage gauche advance (150,80); //réglage vitesse break; case 's'://virage droite advance (80,150); //réglage vitesse break; case 'a'://tourner sur place à gauche turn_L (100,100); break; case 'x'://tourner sur place à droite turn_R (100,100); break; } } }
Posté 24 février 2010 - 01:09
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
Posté 25 février 2010 - 05:21
int inputPinG = 8; int inputPinC = 9; int inputPinD = 10; int valG = 0; int valC = 0; int valD = 0; int E1 = 5; //M1 vitesse int E2 = 6; //M2 vitesse int M1 = 4; //M1 Direction int M2 = 7; //M1 Direction void advance(char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //avancer { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void back_off (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //reculer { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void turn_L (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à gauche { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void turn_R (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à droite { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void setup(void) { int i; for(i=5;i<=8;i++) pinMode(i, OUTPUT); pinMode(inputPinG, INPUT); // declare Infrared sensor as input pinMode(inputPinC, INPUT); // declare Infrared sensor as input pinMode(inputPinD, INPUT); // declare Infrared sensor as input Serial.begin(19200); //Set Baud Rate } void loop(void) { char val = Serial.read(); if(val!='j')//mode manuel { switch (val) { case 'z'://avancer advance (50,50); //réglage vitesse break; case 'w'://reculer back_off (50,50); break; case 'q'://virage gauche advance (70,50); //réglage vitesse break; case 's'://virage droite advance (50,70); //réglage vitesse break; case 'a'://tourner sur place à gauche turn_L (50,50); break; case 'x'://tourner sur place à droite turn_R (50,50); break; case 'c':// stop advance (0,0); break; } } else if(val=='j')//mode auto { [color="#00ff00"]do{[/color] valG = digitalRead(inputPinG); valC = digitalRead(inputPinC); valD = digitalRead(inputPinD); if(valG&&valC&&valD==HIGH) advance(50,50); else if (!valG&&valC&&valD==HIGH) advance(70,50); else if (valG&&valC&&!valD==HIGH) advance(50,70); else turn_R(50,50); } while (val=='j'); } }
Posté 25 février 2010 - 11:24
if(val!='j')//mode manuel
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
Posté 27 février 2010 - 12:34
void loop(void) { void manuel() { char val = Serial.read(); if (val=='h') automatique() else { switch (val) { case 'z'://avancer advance (50,50); //réglage vitesse break; case 'w'://reculer back_off (50,50); break; case 'q'://virage gauche advance (70,50); //réglage vitesse break; case 's'://virage droite advance (50,70); //réglage vitesse break; case 'a'://tourner sur place à gauche turn_L (50,50); break; case 'x'://tourner sur place à droite turn_R (50,50); break; case 'c':// stop advance (0,0); break; } } //fin du test de val } //fin de manuel void automatique() { char val = Serial.read(); if (val=='j') manuel(); valG = digitalRead(inputPinG); valC = digitalRead(inputPinC); valD = digitalRead(inputPinD); if(valG&&valC&&valD==HIGH) advance(50,50) else if (!valG&&valC&&valD==HIGH) advance(70,50) else if (valG&&valC&&!valD==HIGH) advance(50,70) else turn_R(50,50); } // fin de automatique } // fin du loop
Posté 27 février 2010 - 03:10
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
Posté 01 mars 2010 - 10:04
int inputPinG = 8; int inputPinC = 9; int inputPinD = 10; int valG = 0; int valC = 0; int valD = 0; int E1 = 5; //M1 vitesse int E2 = 6; //M2 vitesse int M1 = 4; //M1 Direction int M2 = 7; //M1 Direction void advance(char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //avancer { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void back_off (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //reculer { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void turn_L (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à gauche { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void turn_R (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à droite { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void setup(void) { int i; for(i=5;i<=8;i++) pinMode(i, OUTPUT); pinMode(inputPinG, INPUT); // declare Infrared sensor as input pinMode(inputPinC, INPUT); // declare Infrared sensor as input pinMode(inputPinD, INPUT); // declare Infrared sensor as input Serial.begin(19200); //Set Baud Rate } void loop(void) { void manuel() { char val = Serial.read(); if (val=='h') automatique() else { switch (val) { case 'z'://avancer advance (50,50); //réglage vitesse break; case 'w'://reculer back_off (50,50); break; case 'q'://virage gauche advance (70,50); //réglage vitesse break; case 's'://virage droite advance (50,70); //réglage vitesse break; case 'a'://tourner sur place à gauche turn_L (50,50); break; case 'x'://tourner sur place à droite turn_R (50,50); break; case 'c':// stop advance (0,0); break; } } //fin du test de val } //fin de manuel void automatique() { char val = Serial.read(); if (val=='j') manuel(); valG = digitalRead(inputPinG); valC = digitalRead(inputPinC); valD = digitalRead(inputPinD); if(valG&&valC&&valD==HIGH) advance(50,50); else if (!valG&&valC&&valD==HIGH) advance(70,50); else if (valG&&valC&&!valD==HIGH) advance(50,70); else turn_R(50,50); }// fin de automatique }// fin du loop
Posté 02 mars 2010 - 03:41
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
Posté 02 mars 2010 - 03:46
int inputPinG = 8; int inputPinC = 9; int inputPinD = 10; int valG = 0; int valC = 0; int valD = 0; int E1 = 5; //M1 vitesse int E2 = 6; //M2 vitesse int M1 = 4; //M1 Direction int M2 = 7; //M1 Direction void advance(char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //avancer { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void back_off (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //reculer { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void turn_L (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à gauche { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void turn_R (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à droite { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void setup(void) { int i; for(i=5;i<=8;i++) pinMode(i, OUTPUT); pinMode(inputPinG, INPUT); // declare Infrared sensor as input pinMode(inputPinC, INPUT); // declare Infrared sensor as input pinMode(inputPinD, INPUT); // declare Infrared sensor as input Serial.begin(19200); //Set Baud Rate } void loop(void) { void manuel() { <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<c'est ici. char val = Serial.read(); if (val=='h') automatique() else { switch (val) { case 'z'://avancer advance (50,50); //réglage vitesse break; case 'w'://reculer back_off (50,50); break; case 'q'://virage gauche advance (70,50); //réglage vitesse break; case 's'://virage droite advance (50,70); //réglage vitesse break; case 'a'://tourner sur place à gauche turn_L (50,50); break; case 'x'://tourner sur place à droite turn_R (50,50); break; case 'c':// stop advance (0,0); break; } } //fin du test de val } //fin de manuel void automatique() { char val = Serial.read(); if (val=='j') manuel(); valG = digitalRead(inputPinG); valC = digitalRead(inputPinC); valD = digitalRead(inputPinD); if(valG&&valC&&valD==HIGH) advance(50,50); else if (!valG&&valC&&valD==HIGH) advance(70,50); else if (valG&&valC&&!valD==HIGH) advance(50,70); else turn_R(50,50); }// fin de automatique }// fin du loop
Posté 02 mars 2010 - 03:51
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
Posté 02 mars 2010 - 09:59
int inputPinG = 8; int inputPinC = 9; int inputPinD = 10; int valG = 0; int valC = 0; int valD = 0; void automatique(void) { valG = digitalRead(inputPinG); valC = digitalRead(inputPinC); valD = digitalRead(inputPinD); if(valG&&valC&&valD==HIGH) advance(50,50); else if (!valG&&valC&&valD==HIGH) advance(70,50); else if (valG&&valC&&!valD==HIGH) advance(50,70); else turn_R(50,50); } int E1 = 5; //M1 vitesse int E2 = 6; //M2 vitesse int M1 = 4; //M1 Direction int M2 = 7; //M1 Direction void advance(char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //avancer { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void back_off (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //reculer { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void turn_L (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à gauche { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,LOW); } void turn_R (char a,char <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> //tourner à droite { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2, <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' /> ; digitalWrite(M2,HIGH); } void setup(void) { int i; for(i=5;i<=8;i++) pinMode(i, OUTPUT); pinMode(inputPinG, INPUT); // declare Infrared sensor as input pinMode(inputPinC, INPUT); // declare Infrared sensor as input pinMode(inputPinD, INPUT); // declare Infrared sensor as input Serial.begin(19200); //Set Baud Rate } void loop(void) { automatique(); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<mode automatique<<<<<<<<<<<<<<<<<<<<<<<<fonctionne }
void loop(void) { char val = Serial.read(); if (val=='j') { automatique(); <<<<<<<<<<<<<<<<<<<je veux que lorsque l'on appuie sur j le mode automatique se déroule<<<<<<<<<<<<problème } }
Posté 03 mars 2010 - 04:15
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
Posté 03 mars 2010 - 08:36
void loop() { char val = Serial.read(); switch(val){ case 'j': automatique(); break; default: manuel(); }
void loop(void)
Posté 03 mars 2010 - 01:07
"Plus on partage, plus on possède, voilà le miracle". LEONARD NIMOY
"Celui qui se bat peut perdre, celui qui ne se bat pas a déjà tout perdu". BERTOLT BRECHT (1898-1956)
Comment se lancer dans la robotique !
Mince encore un post pour augmenter mon compteur
0 members, 0 guests, 0 anonymous users