Just got started with Arduino though I’ve been puttering around with other languages for decades.
I’ve got a project that runs a stepper motor for positioning an observatory dome. I started with an existing firmware version that was pretty rough and slowly cut down the code (didn’t believe in functions or classes beyond the most basic uses I guess).
Anyway, I’ve separated the rotator into a mostly stand alone class and now I’ve taking that class out of the .ino and created a .h and .cpp but I’m stumped when it comes to encapsulating the AccelStepper routines within the class. Declared globally in the main program it works fine but I can’t seem to figure out how to declare, instantiate, and initialize AccelStepper using the .h and .cpp
Globally I just have
#include <AccelStepper> AccelStepper accelStepper(AccelStepper::DRIVER, STEPPER_STEP_PIN, STEPPER_DIRECTION_PIN);
then just use accelStepper().
How would I use that inside a class? Or, if there’s a good tutorial somewhere on this general topic I’d love a link!
Thanks for any tips!