Code Monkey home page Code Monkey logo

dual-vnh5019-motor-shield's Introduction

Arduino library for the Pololu Dual VNH5019 Motor Driver Shield

Version: 1.2.2
Release Date: 2014-03-18
www.pololu.com

Summary

This is a library for the Arduino that interfaces with the Pololu Dual VNH5019 Motor Driver Shield. It makes it simple to drive two brushed, DC motors.

Getting Started

Software

Download the archive from GitHub, decompress it, and drag the “DualVNH5019MotorShield” folder to your arduino-00xx/libraries directory. Then restart the Arduino environment, so the libraries can be updated to include the library and its examples.

Hardware

The Dual VNH5019 Motor Driver Shield can be purchased on Pololu’s website. See the motor shield user’s guide for more details.

Example Program

Demo

Open this example code sketch by selecting File→Examples→DualVNH5019MotorShield→Demo.

The demo ramps motor 1 from stopped to full speed forward, ramps down to full speed reverse, and back to stopped. Then, it does the same with the other motor. Both motor’s current readings are sent over serial and can be seen with the serial monitor. If a fault is detected, a message is sent over serial.

Library Reference

DualVNH5019MotorShield()
Default constructor, selects the default pins as connected by the motor shield.
DualVNH5019MotorShield(unsigned char INA1, unsigned char INB1, unsigned char EN1DIAG1, unsigned char CS1,
unsigned char INA2, unsigned char INB2, unsigned char EN2DIAG2, unsigned char CS2)
Alternate constructor for shield connections remapped by user. PWM1 and PWM2 cannot be remapped because the library assumes PWM is on timer1.
void init()
Initialize pinModes and timer1.
void setM1Speed(int speed)
Set speed and direction for motor 1. Speed should be between -400 and 400. 400 corresponds to motor current flowing from M1A to M1B. -400 corresponds to motor current flowing from M1B to M1A. 0 corresponds to full coast.
void setM2Speed(int speed)
Set speed and direction for motor 2. Speed should be between -400 and 400. 400 corresponds to motor current flowing from M2A to M2B. -400 corresponds to motor current flowing from M2B to M2A. 0 corresponds to full coast.
void setSpeeds(int m1Speed, int m2Speed)
Set speed and direction for motor 1 and 2.
void setM1Brake(int brake)
Set brake for motor 1. Brake should be between 0 and 400. 0 corresponds to full coast, and 400 corresponds to full brake.
void setM2Brake(int brake)
Set brake for motor 2. Brake should be between 0 and 400. 0 corresponds to full coast, and 400 corresponds to full brake.
void setBrakes(int m1Brake, int m2Brake)
Set brake for motor 1 and 2.
unsigned int getM1CurrentMilliamps()
Returns current reading from motor 1 in milliamps.
unsigned int getM2CurrentMilliamps()
Returns current reading from motor 2 in milliamps.
unsigned char getM1Fault()
Returns 1 if there is a fault on motor driver 1, 0 if no fault.
unsigned char getM2Fault()
Returns 1 if there is a fault on motor driver 2, 0 if no fault.

Version History

  • 1.2.2 (2014-03-18): Add keywords.txt file. Thanks eatonphil.
  • 1.2.1 (2013-01-06): Fixed a bug in setM2Speed that was introduced in 1.2.0.
  • 1.2.0 (2012-12-26): Changes the behavior of the library at speed 0 so that it makes the motor coast regardless of which direction the motor is spinning.
  • 1.1.0 (2011-12-15): Arduino 1.0 compatibility.
  • 1.0.1 (2011-11-07): Adds support for Arduinos not based on ATmega168/328.
  • 1.0.0 (2011-10-28): Original release.

dual-vnh5019-motor-shield's People

Contributors

kevin-pololu avatar davidegrayson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.