JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Código Ponte H | JustPaste.app
about 1 month ago2 views
👨‍💻Programming

Código Ponte H

// Definição dos pinos da Ponte H (L298N)

// Controle Motor A
int IN1 = 8;
int IN2 = 9;
int ENA = 10;   // PWM

// Controle Motor B
int IN3 = 6;
int IN4 = 7;
int ENB = 5;    // PWM

void setup() {
  // Saídas digitais
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

  // Saídas PWM
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);
}

void loop() {

  // Sentido dos motores: frente
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);

  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);

  // Velocidade dos motores (0 a 255)
  analogWrite(ENA, 180);   // Motor A
  analogWrite(ENB, 180);   // Motor B

}
← Back to timeline