Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Truth Table for Motor Control
- // ENA ENB IN1 IN2 IN3 IN4 Description
- // HIGH HIGH HIGH LOW LOW HIGH Car is going forward
- // HIGH HIGH LOW HIGH HIGH LOW Car is running back
- // HIGH HIGH LOW HIGH LOW HIGH Car is turning left
- // HIGH HIGH HIGH LOW HIGH LOW Car is turning right
- // HIGH HIGH LOW LOW LOW LOW Car is stopped
- // HIGH HIGH HIGH HIGH HIGH HIGH Car is stopped
- // LOW LOW N/A N/A N/A N/A Car is stopped
- #include <Arduino.h>
- // define L298n module IO pin
- #define ENB 5
- #define IN1 7
- #define IN2 8
- #define IN3 9
- #define IN4 11
- #define ENA 6
- void forward() {
- digitalWrite(ENA, HIGH);
- digitalWrite(ENB, HIGH);
- digitalWrite(IN1, HIGH);
- digitalWrite(IN2, LOW);
- digitalWrite(IN3, LOW);
- digitalWrite(IN4, HIGH);
- Serial.println("Forward");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement