Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alex-stone-github/pepstep
Arduino Library for concurrent stepper control
https://github.com/alex-stone-github/pepstep
arduino arduino-ide arduino-library scheduler scheduling-algorithms stepper-library stepper-motor steppers
Last synced: 14 days ago
JSON representation
Arduino Library for concurrent stepper control
- Host: GitHub
- URL: https://github.com/alex-stone-github/pepstep
- Owner: Alex-Stone-Github
- License: mit
- Created: 2025-01-07T14:55:20.000Z (20 days ago)
- Default Branch: master
- Last Pushed: 2025-01-09T21:08:24.000Z (18 days ago)
- Last Synced: 2025-01-09T22:22:08.627Z (18 days ago)
- Topics: arduino, arduino-ide, arduino-library, scheduler, scheduling-algorithms, stepper-library, stepper-motor, steppers
- Language: C++
- Homepage: https://github.com/Alex-Stone-Github/pepstep
- Size: 70.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pepstep
_For stepper motors with pep to their step_![Library Cover Image](docs/cover.png)
## Functionality
This library allows the control of multiple stepper motors concurrently through "ScheduleEntrys."
# Compatability
It supports stepper motors from the Arduino library. The CNCShield wrapper API, "CNCShieldMotor," looks like this:
```cpp
auto get(double steps_per_unit) -> double;
auto set(ScheduleEntry& scheduler, double speed) -> void;
auto stop(ScheduleEntry& scheduler) -> void;
auto reset() -> void;
```# Examples with
## Simple Example
```cpp
#include
#includeCNCShield arduino_shield;
pep::CNCShieldMotor rotation(arduino_shield.get_motor(0));
pep::CNCShieldMotor linear(arduino_shield.get_motor(1));void printhi(void*) {
Serial.println("Hello, World");
Serial.println(linear.get(1.0));
}pep::ScheduleEntry schedule[] = {
CNCSMEntry(rotation),
CNCSMEntry(linear),
pep::ScheduleEntry(1000,(void(*)(void*))(&printhi),NULL),
};void setup() {
Serial.begin(9600);
while (!Serial);
arduino_shield.begin();
arduino_shield.enable();
rotation.set(schedule[0], 0.1);
linear.set(schedule[1],0.2);
}
void loop() {
POLL(schedule);
}
```## Scheduling Example
```cpp
#include
#includeCNCShield arduino_shield;
pep::CNCShieldMotor rotation(arduino_shield.get_motor(0));
pep::CNCShieldMotor linear(arduino_shield.get_motor(1));void printhi(void*) {
Serial.println("Hello, World");
rotation.reset(); // Reset Internal Step Counter, "Encoder"
}pep::ScheduleEntry schedule[] = {
pep::ScheduleEntry(10000, (void(*)(void*))(&pep::CNCShieldMotor::step), (void*)&rotation),
pep::ScheduleEntry(10000, (void(*)(void*))(&pep::CNCShieldMotor::step), (void*)&linear ),
pep::ScheduleEntry(1000, (void(*)(void*))(&printhi), NULL ),
};
void setup() {
Serial.begin(9600);
while (!Serial);
arduino_shield.begin();
arduino_shield.enable();
rotation.set(schedule[0], 0.1);
linear.set(schedule[1],0.2);
}
void loop() {
for (auto& entry : schedule)
entry.poll(millis());
}
```