#include "FastAccelStepper.h"
// As in StepperDemo for Motor 1 on ESP32
#define dirPinStepper 18
#define enablePinStepper 26
#define stepPinStepper 17
FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;
void setup() {
engine.init();
stepper = engine.stepperConnectToPin(stepPinStepper);
if (stepper) {
stepper->setDirectionPin(dirPinStepper);
stepper->setEnablePin(enablePinStepper);
stepper->setAutoEnable(true);
// If auto enable/disable need delays, just add (one or both):
// stepper->setDelayToEnable(50);
// stepper->setDelayToDisable(1000);
stepper->setSpeedInUs(1000); // the parameter is us/step !!!
stepper->setAcceleration(100);
stepper->move(1000);
}
}
void loop() {
digitalWrite(13, HIGH);
Serial.println("Hello Arduino Nano ESP32!");
delay(400);
digitalWrite(13, LOW);
delay(200);
}
Loading
arduino-nano-esp32
arduino-nano-esp32