Arduino library for L298N motor driver.
To install library folow the instructions:
- Close Arduino IDE if it's running
- Download library from GitHub
- Extract library folder to Arduino
libraries
folder. - Run Arduino IDE.
In Files > Examples > BroBots-Motor-Driver
you can find examples.
To include library you can use Sketch > Include Library > BroBots-Motor-Driver
.
Create driver instance:
BroBots_Motor_Driver driver(int ENA, int ENB, int INPins[4]);
int ENA
- pin for left motor's speed, must be PWMint ENB
- pin for right motor's speed, must be PWMint INPins[4]
- all IN pins,{IN1, IN2, IN3, IN4}
Begin driver's work:
driver.begin();
driver.spinForward(int motorSpeed);
int motorSpeed
- motors speed from 0 to 255
driver.spinBackwards(int motorSpeed);
int motorSpeed
- motors speed from 0 to 255
driver.stopMotors();
driver.turnLeft(int motorSpeed, int multiplier);
int motorSpeed
- motors speed from 0 to 255int multiplier
- multiplier of speed for right motor.
driver.spinLeft(int motorSpeed);
int motorSpeed
- motors speed from 0 to 255
driver.turnRight(int motorSpeed, int multiplier);
int motorSpeed
- motors speed from 0 to 255int multiplier
- multiplier of speed for left motor.
driver.spinRight(int motorSpeed);
int motorSpeed
- motors speed from 0 to 255
Main developer - Andrew Yatsura (andrew4ever)
MIT License Copyright (c) 2019 BroBots.Hub