pololu-smc

Crates.iopololu-smc
lib.rspololu-smc
version0.2.1
sourcesrc
created_at2020-12-09 21:08:25.391758
updated_at2020-12-11 19:54:02.062291
descriptionA driver for the Pololu Simple Motor Controller G2
homepage
repositoryhttps://github.com/Karlinde/pololu-smc
max_upload_size
id321298
size38,391
Karl Linderhed (Karlinde)

documentation

README

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})?;
Commit count: 15

cargo fmt