Using Arduino Mega 2560 to control uStepper S

Hi everyone,
This is my first post and I have to admit that I'm quite new to Arduino so please forgive any possible newbie mistake.

I have an Arduino Mega 2560, a uStepper S Stepper Motor Driver and a Nema 23 Stepper Motor.

I managed to control the stepper motor using the uStepper S driver. The board used for this case was uStepper S.
So far so good.

Now I'd like to control the uStepper S driver using the Arduino Mega 2560. My idea is to use SDA - SCL pins for communication (please feel free to propose any better way). I connect the SDA and SCL pins of the Arduino Mega to the SDA and SCL pins of the uStepper. The two devices share a common Ground connection while they have different power supply: uStepper S has its own power supply and the Arduino receives power via the USB connection.
The connections are shown below:



The code I'm using is the following:

#include <uStepperS.h>

#define MAXACCELERATION 70         //Max acceleration = 70 Steps/s^2
#define MAXVELOCITY 70           //Max velocity = 70 steps/s

uStepperS stepper(MAXACCELERATION, MAXVELOCITY);

void setup() {
Serial.begin(9600);
}

void loop(){ 
Serial.println("getMotorState: ");
Serial.println(stepper.getMotorState());
}

When I try to compile the code I get the following error:
C:\Users\u0161078\Documents\Arduino\libraries\uStepper_S\src/uStepperS.h:142:3: error: #error !!This library only supports the uStepper S board!!

  • #error !!This library only supports the uStepper S board!!*

  • ^~~~~*

C:\Users\u0161078\Documents\Arduino\libraries\uStepper_S\src/uStepperS.h:146:3: error: #error !!This library only supports the ATmega328PB MCU!!

  • #error !!This library only supports the ATmega328PB MCU!!*

  • ^~~~~*

I looked into uStepper.h file and I found that the following checks produce the error:

#ifndef ARDUINO_AVR_USTEPPER_S
	#error !!This library only supports the uStepper S board!!
#endif

#ifndef __AVR_ATmega328PB__
	#error !!This library only supports the ATmega328PB MCU!!
#endif

Any ideas on how to resolve this error with a final aim to control the uStepper S with my Arduino Mega 2560?

Thanks in advance,
Antonis

Read " GitHub - uStepper/uStepperS

topics : " Hardware Installation " and " Instructions for users new to uStepper"

Visit : https://www.ustepper.com/

Thanks for your reply,
I already performed these instructions.
No luck.

To make my issue more clear:
I cannot include uStepperS.h when the selected board is Mega 2560.
When I switch the board to uStepperS the code runs smoothly.

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