#define INA 1
#define INB 2
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println("Iniciando demo L298N com a Franzininho WiFi");
pinMode(INA, OUTPUT);
pinMode(INB, OUTPUT);
digitalWrite(INA, LOW);
digitalWrite(INB, LOW);
}
void loop() {
Serial.println("Rotaciona sentido horario");
digitalWrite(INA, HIGH);
digitalWrite(INB, LOW);
delay(2000);
Serial.println("Motor Parado");
digitalWrite(INA, LOW);
digitalWrite(INB, LOW);
delay(2000);
Serial.println("Rotaciona sentido anti-horario");
digitalWrite(INA, LOW);
digitalWrite(INB, HIGH);
delay(2000);
Serial.println("Freia rotação");
digitalWrite(INA, HIGH);
digitalWrite(INB, HIGH);
delay(2000);
Serial.println("Motor Parado");
digitalWrite(INA, LOW);
digitalWrite(INB, LOW);
delay(2000);
Serial.println("Controle de Velocidade");
int i;
for(i = 0; i<255; i++)
{
analogWrite(INA,i);
delay(100);
}
for(i =255; i>=0; i--)
{
analogWrite(INA,i);
delay(100);
}
Serial.println("Para controle de Velocidade");
digitalWrite(INA, LOW);
digitalWrite(INB, LOW);
delay(2000);
}
Loading
franzininho-wifi
franzininho-wifi