1 #ifndef STEPPERCONTROLLER_H
2 #define STEPPERCONTROLLER_H
5 #include <ArduinoLog.h>
10 #include <ModbusValue.h>
12 #include <AccelStepper.h>
14 #include "../features.h"
16 #include "../config.h"
58 short addressStart) : ModbusValue<int[]>(addressStart),
59 Component(
"Stepper", id, Component::COMPONENT_DEFAULT, owner),
60 stepper(AccelStepper::DRIVER, pulsePin, dirPin),
73 SBI(nFlags, OBJECT_NET_CAPS::E_NCAPS_MODBUS);
74 Log.verboseln(
"stepper controller created");
77 short speed(
short val0,
short val1 = 0)
87 short dir(
short val0,
short val1)
94 setRegisterMode(MB_REGISTER_MODE::E_MB_REGISTER_MODE_READ_WRITE);
96 setFunctionCode(MB_FC::MB_FC_READ_REGISTERS);
115 Log.verboseln(
"StepperController::debug Speed=%d | Dir=%d | Address=%d | Status=%d | Load=%d",
_speed,
_dir, addr,
_status, analogRead(
_overload));