pololu-smc 0.2.1

A driver for the Pololu Simple Motor Controller G2
Documentation
  • Coverage
  • 100%
    121 out of 121 items documented1 out of 50 items with examples
  • Size
  • Source code size: 38.39 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.19 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Karlinde/pololu-smc
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Karlinde

pololu-smc

A hardware-independent driver for the Pololu Simple Motor Controller G2 (https://www.pololu.com/category/94/pololu-simple-motor-controllers). Note that only the new generation of controllers, with the "G2" suffix, are supported.

This crate aims to provide a user-friendly interface to the motor controller. Commands and variables are represented as structs and enums, to avoid having to bother the user with the details of the low-level communication protocols.

Currently only the I2C protocol is implemented. It should however be easy to add support for the serial protocol as well.

Example

use pololu_smc::{SimpleMotorController, Command};

...

// Here, "interface" implements some I2C traits from embedded_hal
// 0x12 is the device number/address
let mut controller = SimpleMotorController::new(interface, 0x12);

let errors = controller.get_error_status()?;

controller.send_command(Command::ExitSafeStart)?;
controller.send_command(Command::MotorFwd{speed: 500})?;