Skip to content

Arduino library that allows DC motors to gradually reach their new power level, within allowed PWM ranges

License

Notifications You must be signed in to change notification settings

Elijas/arduino-motor-control-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

Description:

This is an arduino library that allows the power given to motors increase/decrease gradually (and not instantaneously as with analogWrite() function which this library is meant to replace).

Features:

  • Lower and upper power limits (e.g. for motors that are able spin only when PWM duty cycle is above some threshold, (i.e. when the value is big enough in analogWrite(pin,value)))
  • Adjustable rate of power change (by changing step size and/or update delay)
  • Any number of motors (currently two are supported, modify header to allow for more)

Usage:

Timer timer;
Motor myMotor(0, 2, 3, 0, 255, 1, 30, &timer);

myMotor.set(255)

(see example code for details)

(NB: It is necessary for Timer library to be added to arduino)