Steren ARD-020 Manual De Instrucciones página 60

Tarjeta programadora compatible con arduino tipo leonardo
Tabla de contenido

Publicidad

Idiomas disponibles

Idiomas disponibles

Program
Motor control with L293D driver
int value = 0; // a variable that contains the value
int motorFowards = 10; // Motor forward - > PIN 10
int motorBackwards = 11; // Motor recoil - > PIN 11
void setup() {} // Not necessary
void loop() {
analogWrite(motorBackwards, 0); // Motor forward... raises the speed
for(value = 0; value <= 255; value+=5) {
analogWrite (motorFowards, value);
delay (30);
}
for(value = 255; value >=0; value-=5) { // forward motor... lowers the speed
analogWrite (motorFowards, value);
delay (30);
}
analogWrite(motorFowards, 0); // Motor back... raises the speed
for(value = 0; value <= 255; value+=5) {
analogWrite (motor motorBackwards, value);
delay (30);
}
for(value = 255; value >=0; value-=5) { // motor backwards... lowers speed }
analogWrite (motorBackwards, value);
delay (30);
}
}
28
28

Publicidad

Tabla de contenido
loading

Tabla de contenido