Projet

Général

Profil

Banc Test » Capteur_optique_sans_compteur.ino.ino

Programme - Thomas Coment, 24/11/2020 11:16

 
#define optique1 9
#define optique2 8
#define PUL 7
#define DIR 6
#define ENA 5

unsigned long compteur;
int valeur;

void setup() {
Serial.begin(115200);
pinMode(optique1, INPUT);
pinMode(optique2, INPUT);
pinMode(PUL, OUTPUT);
pinMode(DIR, OUTPUT);
pinMode(ENA, OUTPUT);
}

void loop(){
for (int i=0; i<6400; i++){
digitalWrite(DIR,LOW);
digitalWrite(ENA,HIGH);
digitalWrite(PUL,HIGH);
delayMicroseconds(500);
digitalWrite(PUL,LOW);
delayMicroseconds(500);
}
for (int i=0; i<6400; i++){
digitalWrite(DIR,HIGH);
digitalWrite(ENA,HIGH);
digitalWrite(PUL,HIGH);
delayMicroseconds(500);
digitalWrite(PUL,LOW);
delayMicroseconds(500);
}
}
(1-1/4)