Outils pour utilisateurs

Outils du site


projets:2019:stageavrilubo

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
projets:2019:stageavrilubo [2019/04/11 17:00] – [Impressions Faites] yannvprojets:2019:stageavrilubo [2022/09/04 21:04] (Version actuelle) – modification externe 127.0.0.1
Ligne 125: Ligne 125:
   * Benjamin    * Benjamin 
   * Arnaud (mercredi après midi et jeudi)   * Arnaud (mercredi après midi et jeudi)
-  * Simon+  * Simon (mercredi après midi peut-être et jeudi et vendredi à priori) 
 +  * Tanguy (jeudi) 
 +  * 
  
 ===== Déroulé du projet ===== ===== Déroulé du projet =====
Ligne 197: Ligne 199:
 Fichier de présentation Fichier de présentation
  
 +
 +=== 3D ===
 +
 +Exemple d'accessoire pour la tête:
 +{{:projets:2019:atelier_lph_head_debug.png?400|}}
 +
 +Code OpenSCAD pour ajouter l'accessoire sur la tête:
 +<code>
 +#rotate([180,0,0]) import("<path>/Documents/Head.stl");
 +
 +rotate_extrude() { polygon(points=[[0,0],[10,0],[10,10],[25,25],[0,25]]);
 +}
 +</code>
 +
 +Exemple de texte pour le dozer:
 +{{:projets:2019:atelier_lph_dozer.png?400|}}
 +
 +
 +Code OpenSCAD pour ajouter le texte sur le dozer:
 +<code>
 +#translate([0,0,-23]) rotate([-90,-90,0]) import("<path>/Documents/Dozer.stl");
 +
 +translate ([-12,15,-3]) linear_extrude(height=5) { 
 +    text("LPH");
 +}
 +</code>
  
 === Code === === Code ===
  
-Code + 
 +Pour récupérer le code du robot adapté: 
 + 
 +<code> 
 +$ git clone https://git.archieri.fr/simon/SimpleBotArduino.git 
 + 
 +</code> 
 + 
 +Android APK pour le robot Arduino: 
 +https://cloud.archieri.fr/s/WzxmeGBmEKow5co 
 + 
 + 
 + 
 +Test Servo 
 +<code> 
 + 
 +# include <Servo.h> 
 + 
 +Servo servoLeft; 
 +Servo servoRight; 
 + 
 +void setup() { 
 +  servoLeft.attach(11); 
 +  servoRight.attach(10); 
 +  Serial.begin(9600); 
 +
 + 
 +void loop() { 
 +  servoLeft.write(90); // 0 => sens, 180 => autre sens 
 +  servoRight.write(90); //  
 +
 + 
 +void stop() { 
 +  servoLeft.write(90); // 0 => sens, 180 => autre sens 
 +  servoRight.write(90); //  
 +
 + 
 +void avancer() { 
 +  servoLeft.write( xx  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( xx ); //  
 +
 + 
 +void reculer() { 
 +  servoLeft.write( xx  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( xx ); //  
 +
 + 
 +void tourner() { 
 +  servoLeft.write( xx  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( xx ); //  
 +
 + 
 +</code> 
 + 
 +Avec le sonar 
 +<code> 
 +#include <NewPing.h> 
 +#include <Servo.h> 
 + 
 +Servo servoLeft; 
 +Servo servoRight; 
 + 
 +NewPing sonar(7, 6, 200); 
 + 
 +void setup() { 
 +  servoLeft.attach(11); 
 +  servoRight.attach(10); 
 +  Serial.begin(9600); 
 +
 + 
 +void loop() { 
 +  gestionSonar(); 
 +
 + 
 +void gestionSonar() { 
 +  int distance = sonar.ping_cm(); 
 +  avancer(); 
 +  if (distance < 10) { 
 +    reculer(); 
 +    tournerGauche(); 
 +  } 
 +
 + 
 +void stop() { 
 +  servoLeft.write(90); // 0 => sens, 180 => autre sens 
 +  servoRight.write(90); //  
 +
 + 
 +void avancer() { 
 +  servoLeft.write( 0  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( 180 ); //  
 +
 + 
 +void reculer() { 
 +  servoLeft.write( 180  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( 0 ); //  
 +
 + 
 +void tournerGauche() { 
 +  servoLeft.write(45); // 0 => sens, 180 => autre sens 
 +  servoRight.write(45); //  
 +
 + 
 +void tournerDroite() { 
 +  servoLeft.write(135); // 0 => sens, 180 => autre sens 
 +  servoRight.write(135); //  
 +
 + 
 +</code> 
 + 
 + 
 +Avec le bluetooth (message provenant du robot): 
 +<code> 
 +#include <NewPing.h> 
 +#include <Servo.h> 
 +#include <SoftwareSerial.h> 
 + 
 +Servo servoLeft; 
 +Servo servoRight; 
 + 
 +NewPing sonar(7, 6, 200); 
 + 
 +SoftwareSerial BTSerial(4, 8); // TX, RX 
 + 
 +void setup() { 
 +  servoLeft.attach(11); 
 +  servoRight.attach(10); 
 +  //Serial.begin(9600); 
 +  BTSerial.begin(9600); 
 +
 + 
 +void loop() { 
 +  gestionSonar(); 
 +
 + 
 +void gestionSonar() { 
 +  int distance = sonar.ping_cm(); 
 +  avancer(); 
 +  if (distance > 0 && distance < 10) { 
 +    BTSerial.println("obstacle < 10cm");  
 +    reculer(); 
 +    tournerGauche(); 
 +  } 
 +
 + 
 +void stop() { 
 +  servoLeft.write(90); // 0 => sens, 180 => autre sens 
 +  servoRight.write(90); // 
 +  BTSerial.println("stop");  
 +
 + 
 +void avancer() { 
 +  servoLeft.write( 0  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( 180 ); //  
 +  BTSerial.println("avance"); 
 +
 + 
 +void reculer() { 
 +  servoLeft.write( 180  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( 0 ); //  
 +  BTSerial.println("recule"); 
 +
 + 
 +void tournerGauche() { 
 +  servoLeft.write(45); // 0 => sens, 180 => autre sens 
 +  servoRight.write(45); //  
 +  BTSerial.println("gauche"); 
 +
 + 
 +void tournerDroite() { 
 +  servoLeft.write(135); // 0 => sens, 180 => autre sens 
 +  servoRight.write(135); //  
 +  BTSerial.println("droite"); 
 +
 + 
 +</code> 
 + 
 + 
 +Avec le bluetooth (piloter le robot): 
 +<code> 
 +#include <NewPing.h> 
 +#include <Servo.h> 
 +#include <SoftwareSerial.h> 
 + 
 +Servo servoLeft; 
 +Servo servoRight; 
 + 
 +NewPing sonar(7, 6, 200); 
 + 
 +SoftwareSerial BTSerial(4, 8); // TX, RX 
 + 
 +String message; 
 + 
 +void setup() { 
 +  servoLeft.attach(11); 
 +  servoRight.attach(10); 
 +  //Serial.begin(9600); 
 +  BTSerial.begin(9600); 
 +
 + 
 +void loop() { 
 +  gestionSonar(); 
 +  readBTSerial(); 
 +
 + 
 +String readBTSerial() { 
 +  while (BTSerial.available()) { 
 +    message = BTSerial.readString();   
 +  } 
 +  if (message == "av\r\n") { 
 +    avancer(); 
 +  } else if (message == "ar\r\n") { 
 +    reculer(); 
 +  } else if (message == "g\r\n") { 
 +    tournerGauche(); 
 +  } else if (message == "d\r\n") { 
 +    tournerDroite(); 
 +  } 
 +
 + 
 +void gestionSonar() { 
 +  int distance = sonar.ping_cm(); 
 +  avancer(); 
 +  if (distance > 0 && distance < 10) { 
 +    BTSerial.println("obstacle < 10cm");  
 +    reculer(); 
 +    tournerGauche(); 
 +  } 
 +
 + 
 +void stop() { 
 +  servoLeft.write(90); // 0 => sens, 180 => autre sens 
 +  servoRight.write(90); // 
 +  BTSerial.println("stop");  
 +
 + 
 +void avancer() { 
 +  servoLeft.write( 0  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( 180 ); //  
 +  BTSerial.println("avance"); 
 +
 + 
 +void reculer() { 
 +  servoLeft.write( 180  ); // 0 => sens, 180 => autre sens 
 +  servoRight.write( 0 ); //  
 +  BTSerial.println("recule"); 
 +
 + 
 +void tournerGauche() { 
 +  servoLeft.write(45); // 0 => sens, 180 => autre sens 
 +  servoRight.write(45); //  
 +  BTSerial.println("gauche"); 
 +
 + 
 +void tournerDroite() { 
 +  servoLeft.write(135); // 0 => sens, 180 => autre sens 
 +  servoRight.write(135); //  
 +  BTSerial.println("droite"); 
 +
 + 
 +</code> 
  
projets/2019/stageavrilubo.1555002044.txt.gz · Dernière modification : 2022/09/04 21:03 (modification externe)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki