Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

brobots-hub/brobots-motor-driver

Repository files navigation

#brobots Motor Driver Library

Arduino library for L298N motor driver.

Instalation

To install library folow the instructions:

  1. Close Arduino IDE if it's running
  2. Download library from GitHub
  3. Extract library folder to Arduino libraries folder.
  4. 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.

General Documentation

Setup

Create driver instance:

BroBots_Motor_Driver driver(int ENA, int ENB, int INPins[4]);
  • int ENA - pin for left motor's speed, must be PWM
  • int ENB - pin for right motor's speed, must be PWM
  • int INPins[4] - all IN pins, {IN1, IN2, IN3, IN4}

Begin driver's work:

driver.begin();

Moves

Forward:

driver.spinForward(int motorSpeed);
  • int motorSpeed - motors speed from 0 to 255

Backwards:

driver.spinBackwards(int motorSpeed);
  • int motorSpeed - motors speed from 0 to 255

Stop:

driver.stopMotors();

Turn Left:

driver.turnLeft(int motorSpeed, int multiplier);
  • int motorSpeed - motors speed from 0 to 255
  • int multiplier - multiplier of speed for right motor.

Spin Left:

driver.spinLeft(int motorSpeed);
  • int motorSpeed - motors speed from 0 to 255

Turn Right:

driver.turnRight(int motorSpeed, int multiplier);
  • int motorSpeed - motors speed from 0 to 255
  • int multiplier - multiplier of speed for left motor.

Spin Right:

driver.spinRight(int motorSpeed);
  • int motorSpeed - motors speed from 0 to 255

Credits

Main developer - Andrew Yatsura (andrew4ever)

License

MIT License Copyright (c) 2019 BroBots.Hub

About

Arduino library for L298N motor driver.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages