Outils d'utilisateurs

Outils du Site


projets:conception_d_un_robot_a_base_d_arduino

Différences

Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.

Lien vers cette vue

projets:conception_d_un_robot_a_base_d_arduino [2018/02/18 15:35]
thierry_dasse
projets:conception_d_un_robot_a_base_d_arduino [2018/02/18 15:45] (Version actuelle)
thierry_dasse
Ligne 10: Ligne 10:
 liens: liens:
 tags: tags:
-usager:thierry_dasse doudoulolita ivan emmanuel sarah +usager: "le contenu est le fruit du travail des participants"
 licence:cc-by-sa licence:cc-by-sa
 }}} }}}
Ligne 27: Ligne 27:
  
 Schéma conceptuel de la pince Schéma conceptuel de la pince
-{{:projets:conception_d_un_robot_a_base_d_arduino:pince.png?100 |}}+ 
 +{{:projets:conception_d_un_robot_a_base_d_arduino:pince.png?200|Schéma conceptuel de la pince}} 
  
 Schéma de montage du prototype pour tester le programme Schéma de montage du prototype pour tester le programme
-{{:projets:conception_d_un_robot_a_base_d_arduino:pince_robot_bb.png?100 |}}+ 
 +{{:projets:conception_d_un_robot_a_base_d_arduino:pince_robot_bb.png?200|Schéma de montage du prototype}} 
  
  
Ligne 64: Ligne 68:
  
  
 +Fichier tactilservo.cpp à insérer dans le répertoire Arduino/librairies/TactilServo
 +
 +Pendant la séance du 17 février, nous n'avons pas eu le temps d'implémenter toutes les méthodes. Il nous faudra finir.
 +
 +<code c++>
 +
 +#include "tactilservo.h"
 +
 +void TactilServo::init(int servoPin, int switchPin) {
 +  this->servoPin = servoPin;
 +  this->switchPin = switchPin;
 +  this->openPos = 180;
 +  this->closePos = 0;
 +  this->angleDelay = 15;
 +  this->attach(this->servoPin);
 +  pinMode(this->switchPin,INPUT);
 +  digitalWrite(this->switchPin,HIGH);
 +}
 +
 +void TactilServo::setOpenPos(int pos) {
 +  // A faire
 +}
 +
 +void TactilServo::setClosePos(int pos) {
 +  // A faire
 +}
 +
 +void TactilServo::setAngleSpeed(int s) {
 +  // A faire
 +}
 +  
 +void TactilServo::open() {
 +  this->write(this->openPos);
 +}
 +
 +int TactilServo::close() {
 +  int pos = this->read();
 +  while ((digitalRead(this->switchPin) != 0) && (pos > this->closePos)) {
 +    pos -= 1;
 +    this->write(pos);
 +    delay(this->angleDelay);
 +  }
 +}
 +
 +</code>
 +
 +Programme de test testpince.ino
 +
 +<code c++>
 +#include "tactilservo.h"
 +
 +TactilServo mapince;
 +
 +void setup() {
 +  mapince.init(3,2); 
 +}
 +
 +void loop() {
 +  mapince.open();
 +  delay(2000);
 +  mapince.close(); //si on appuie sur le poussoir, la pince s'arrête
 +  delay(5000);
 +}
 +
 +</code>
  
  
projets/conception_d_un_robot_a_base_d_arduino.1518964550.txt.gz · Dernière modification: 2018/02/18 15:35 par thierry_dasse