Stepper Test Library

Hi, I have an Arduino Mega 2560 with an L298N and a Nema 17 stepper motor. What I am wanting to know is what I am doing wrong making a library for controlling the frequency and how long the stepper motor will be on? I am trying to use the stepper.h, stepper.cpp, Accelstepper.h, and Accelstepper.cpp files as an example, but I get this error:

exit status 1
Error compiling for board Arduino Mega or Mega 2560.

Yes, the board is plugged up to the computer, but this message appears above that message:

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\austin\\Documents\\Arduino\\libraries\\stepperTestLibrary" "C:\\Users\\austin\\Documents\\Arduino\\libraries\\stepperTestLibrary\\stepperTestLibrary.cpp" -o "C:\\Users\\austin\\AppData\\Local\\Temp\\arduino_build_519425\\libraries\\stepperTestLibrary\\stepperTestLibrary.cpp.o"
C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.cpp:13:1: error: prototype for 'stepperTest::stepperTest(int, int, int, int)' does not match any in class 'stepperTest'
 stepperTest::stepperTest(int SMPin1, int SMPin2, int SMPin3, int SMPin4){
 ^~~~~~~~~~~
In file included from C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.cpp:11:0:
C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.h:15:7: error: candidates are: constexpr stepperTest::stepperTest(stepperTest&&)
 class stepperTest{
       ^~~~~~~~~~~
C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.h:15:7: error:                 constexpr stepperTest::stepperTest(const stepperTest&)
C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.h:19:1: error:                 stepperTest::stepperTest(uint8_t, uint8_t, uint8_t, uint8_t)
 stepperTest(uint8_t SMPin1, uint8_t SMPin2, uint8_t SMPin3, uint8_t SMPin4);
 ^~~~~~~~~~~
C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.cpp:29:6: error: prototype for 'void stepperTest::runStepper(int, int)' does not match any in class 'stepperTest'
 void stepperTest::runStepper(int frequency, int duration){
      ^~~~~~~~~~~
In file included from C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.cpp:11:0:
C:\Users\austin\Documents\Arduino\libraries\stepperTestLibrary\stepperTestLibrary.h:21:6: error: candidate is: void stepperTest::runStepper(uint8_t, uint8_t)
 void runStepper(uint8_t frequency, uint8_t duration);
      ^~~~~~~~~~

I don't know what this means and I have tried to fix the library several times, but remained unsuccessful. Any help with fixing this library based on this error message would be great. The purpose of this library is to make (hopefully) some stepper motor music. I used a test to figure out how the speed had to do with the musical pitch and it turned out successful. According to my test with the Accel library, the RPM has to do with the frequency of the musical pitch. Here it is:

#include <AccelStepper.h>
#include <MultiStepper.h>

// initialize the stepper library on pins 8 through 11:
AccelStepper myStepper(AccelStepper::FULL4WIRE, 22, 23, 24, 25);


void setup() {
  // put your setup code here, to run once:

myStepper.setMaxSpeed(1000);
myStepper.setSpeed(440);
  
}

void loop() {
  // put your main code here, to run repeatedly:

myStepper.runSpeed();

}

-Thanks,

Austin

stepperTestLibrary.zip (2.3 KB)

Post a link to the stepper.
That driver has no current control and should be avoided for most steppers.

Link for Stepper with Datasheet

Okey. Using 12 volt for that stepper that primitive driver will work.

Why the line #include <MultiStepper.h>? I'm not sure if that creates the trouble. Try without it.

I did that and the test example still worked. No, what I was talking about earlier was the library that I made wasn't working. I don't know why basically.

Okey. You are modifying a library. That's beyond my capacity but You surely need to post that alteration some way. Let's se if some other helper steps in.

Alright, thanks!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.