steperb 0.2.0

A stepper motor control library for embedded systems
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented0 out of 0 items with examples
  • Size
  • Source code size: 43.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 172.51 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 22s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ktechhydle

steperb

steperb is a superb stepper motor control library designed for robotics and embedded systems. It is fully no-std compatible, and is designed for calculating what, where, when and why the motor should be doing actions.

use steperb::StepperController;

fn main() {
    // 1.8° per step (200 steps per revolution)
    let mut controller = StepperController::new(200);
    controller.set_desired_angle(45.0);

    while controller.needs_movement() {
        if controller.is_reversed() {
            println!("Moving in opposite direction.");
        }

        controller.apply_step(); // one step
        println!("{}", controller.current_steps());
    }
}

Features

  • Easy and simple to use
  • Safe, idiomatic interfacing (no unsafe blocks)
  • no-std compatible and memory efficient for embedded devices
  • Accurate positioning and calculation logic

Using steperb

steperb is explicitly designed to model stepper motors - it doesn't actually implement stepper motor pulse logic. You can model a stepper motor with a StepperController object.

use steperb::StepperController;

fn main() {
    let mut controller = StepperController::new(/* steps per revolution */);
}

StepperController objects allow you to "control" a stepper motor, modeling steps and angle calculations. To use the controller, set a desired angle.

// ...
controller.set_desired_angle(45.0).expect("Error setting angle");

Increment through each step with motor actions.

// ... 
while controller.needs_movement() {
    controller.apply_step();

    // stepper motor pulse logic here
}

You can also check if the motor should be moving in the opposite direction.

// ... 
while controller.needs_movement() {
    controller.apply_step();

    if controller.is_reversed() {
        // stepper motor reversing pulse logic here
    }
}

Free & Open-Source

steperb is 100% free with no drawbacks or limitations. There is no "premium" version; you get the latest and greatest, all licensed under the GPL-3.0.

All source code is public, to anyone. There is no "hidden mechanism" included in this repository; every reference and used factor exists completely and fully.