https://github.com/lemonpi/motorshieldcontroller
Motor controller for Arduino through a motor shield
https://github.com/lemonpi/motorshieldcontroller
Last synced: 4 months ago
JSON representation
Motor controller for Arduino through a motor shield
- Host: GitHub
- URL: https://github.com/lemonpi/motorshieldcontroller
- Owner: LemonPi
- Created: 2017-11-11T17:10:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-11T17:37:01.000Z (over 8 years ago)
- Last Synced: 2025-01-03T13:52:24.846Z (about 1 year ago)
- Language: C++
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Arduino library for a H-Bridge motor controller (driver) of a single motor
Two ways to use this:
1. Drop directory directly inside sketch
or
1. Move directory under Arudino libraries directory
2. In Arduino IDE with sketch open select Sketch > Include Library > WheelEncoder (should be under Contributed Libraries)
## Usage
Connect pins according to data sheet
```c++
#include
#include
// shield pins
constexpr auto DIR_LEFT = 13;
constexpr auto ENABLE_LEFT = 11;
constexpr auto DIR_RIGHT = 12;
constexpr auto ENABLE_RIGHT = 10;
MotorShieldController mc(DIR_LEFT, DIR_RIGHT, ENABLE_LEFT, ENABLE_RIGHT);
void setup() {
}
void loop() {
mc.setLeftVelocity(50);
mc.setRightVelocity(-50);
mc.go();
}
```