Serial Controlled Motor Driver (SCMD) (ROB-13911)
- /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
- /extras - Additional documentation for the user. These files are ignored by the IDE.
- /src - Source files for the library (.cpp, .h).
- keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
- library.properties - General library properties for the Arduino package manager.
- Installing an Arduino Library Guide - Basic information on how to install an Arduino library.
- Product Repository - Main repository (including hardware files) for the SCMD.
- Hookup Guide - Basic hookup guide for the SCMD.
There are a few classes used in the library. The main class is called SCMD
, which is the object that talks to the motor drivers. There are also a couple structs in use -- SCMDSettings
and SCMDDiagnostics
. A SCMDSettings
object named settings is present within the SCMD class for configuration.
Contains a bunch of 8 bit values of data for use with getDiagnostics and getRemoteDiagnostics.
Contains the settings used by SCMD.
The main class which controls 1 master and connected slaves.
The library is made such that new motor driver objects are constructed without parameters, and are configured later before calling .begin()
.
Example:
SCMD myMotorDriver; //This creates an instance of SCMD which will be bound to a single master.
The main SCMD class has a public member which is named settings. To configure settings, use the format myMotorDriver.settings.I2CAddress = (...);
then call .begin() to apply.
settings contains the following members:
- uint8_t commInterface -- Set equal to I2C_MODE or SPI_MODE
- uint8_t I2CAddress -- Set to address that master is configured to in case of I2C usage
- uint8_t chipSelectPin -- Set to chip select pin used on Arduino in case of SPI
Call after providing settings to start the wire library, apply the settings, and get the ID word (return value should be 0xA9). Don't progress unless this returns 0xA9!
This function checks to see if the SCMD is done booting and is ready to receive commands. Use this after .begin(), and don't progress to your main program until this returns true.
This function checks to see if the SCMD busy with an operation. Wait for busy to be clear before sending each configuration commands (not needed for motor drive levels).
Call after .begin(); to allow PWM signals into the H-bridges. If any outputs are connected as bridged, configure the driver to be bridged before calling .enable();. This prevents the bridges from shorting out each other before configuration.
Call to remove drive from the H-bridges. All outputs will go low.
This resets the I2C hardware for Teensy 3 devices using the alternate library, and nothing otherwise.
This sets an output to drive at a level and direction.
- channel: Motor number, 0 through 33.
- direction: 1 or 0 for forward or backwards.
- level: 0 to 255 for drive strength.
This switches the perceived direction of a particular motor.
- motorNum: Motor number, 0 through 33.
- polarity: 0 for normal and 1 for inverted direction.
This connects any board's outputs together controlling both from what was the 'A' position.
- driverNum: Number of connected SCMD, 0 (master) to 16.
- bridged: 0 for normal and 1 for bridged.
This returns a diagnostic report from the master.
- &diagObjectReference: Pass a local SCMDDiagnostics object that will be written into.
This returns a diagnostic report from a slave.
- address: address of intended slave. This starts at 0x50 for the first slave and goes up from there.
- &diagObjectReference: Pass a local SCMDDiagnostics object that will be written into.
Clears the diagnostic counts of a master.
Clears the diagnostic counts of a slave.
- address: address of intended slave. This starts at 0x50 for the first slave and goes up from there.
Returns the contents of a memory location of the master.
- offset: Memory address to read.
Writes data to a memory location of the master.
- offset: Memory address to write.
- dataToWrite: Data to write to that address.
Returns the contents of a memory location of a slave.
- address: address of intended slave. This starts at 0x50 for the first slave and goes up from there.
- offset: Memory address to read.
Writes data to a memory location of a slave.
- address: address of intended slave. This starts at 0x50 for the first slave and goes up from there.
- offset: Memory address to write.
- dataToWrite: Data to write to that address.
- ROB-13911- A serial controlled bridgable driver for small DC motors.
- V_1.0.0 - Public Release
This product is open source!
Please review the LICENSE.md file for license information.
If you have any questions or concerns on licensing, please contact [email protected].
Distributed as-is; no warranty is given.
- Your friends at SparkFun.