const int izq = 13;
const int der = 12;
const int m1 = 3;
const int m2 = 2;
const int v = 9;
int b1 = 0;
int b2 = 0;
void setup() {
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);
pinMode(v, OUTPUT);
pinMode(izq, INPUT);
pinMode(der, INPUT);
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(v, LOW);
}
void loop(){
b1 = digitalRead(izq);
if (b1 == HIGH) {
digitalWrite(v, LOW);
digitalWrite(m1, HIGH);
digitalWrite(m2, LOW);
digitalWrite(v, HIGH);
}
b2 = digitalRead(der);
if (b2 == HIGH) {
digitalWrite(v, LOW);
digitalWrite(m1, LOW);
digitalWrite(m2, HIGH);
digitalWrite(v, HIGH);
}
}
No hay comentarios:
Publicar un comentario