gin66 / FastAccelStepper

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3 and Atmel SAM Due
MIT License
282 stars 67 forks source link

Pin problem with arduino mega #234

Closed PregLizZz closed 3 months ago

PregLizZz commented 4 months ago

Hi, I have a problem with the pins of arduino Mega and Im pretty sure I do something wrong. This is the example code where I modified the stepPin, steps, speed, and acceleration and it works perfectly.

 #include "FastAccelStepper.h"
  #include "AVRStepperPins.h" // Only required for AVR controllers

  #define dirPinStepper    5
  #define stepPinStepper   6

  // If using an AVR device use the definitons provided in AVRStepperPins
  //    stepPinStepper1A
  //
  // or even shorter (for 2560 the correct pin on the chosen timer is selected):
  //    stepPinStepperA

  FastAccelStepperEngine engine = FastAccelStepperEngine();
  FastAccelStepper *stepper = NULL;

  void setup() {
     engine.init();
     stepper = engine.stepperConnectToPin(stepPinStepper);
     if (stepper) {
        stepper->setDirectionPin(dirPinStepper);
        stepper->setSpeedInHz(4000);       // 500 steps/s
        stepper->setAcceleration(200);    // 100 steps/s²
        stepper->move(4000);
     }
  }
  void loop() {
  }

When I change the stepperPin to 7, the max speed with which it works is 1000 steps/s when I set it to 1001 or above, the motor doesn't move at all. Comparing with the docu Pin 6, 7 and 8 should work. Can someone point me in the right direction, please?

gin66 commented 4 months ago

Known bug #221 and fixed in 0.30.10

I assume, you use ArduinoIDE with their buggy Library manager , which is stuck with 0.30.0 instead of latest 0.30.11

gin66 commented 3 months ago

stale