28BYJ-48 Works on Arduino Uno, but not on Mega2560

Hello, im using the 28BYJ-48 with 5 Volts power supply. I runs with an ULN2003. On the Arduino Uno it works well. But on the Arduino Mega 2560 or an ESP32 it does not work. It just makes random noise and vibrates... I have already tried multiple Pin Connections within the digital PWM 2-5 and 8-11. I also randomly tried higher pins like 40-44.

#include <Stepper.h>

#define stepsPerRevolution 2038
#define IN1 11
#define IN2 10
#define IN3 9
#define IN4 8


Stepper myStepper = Stepper(stepsPerRevolution, IN1, IN2, IN3, IN4);

void setup() {

}

void loop() {
	myStepper.setSpeed(5);
	myStepper.step(stepsPerRevolution);
	delay(1000);
	
	myStepper.setSpeed(10);
	myStepper.step(-stepsPerRevolution);
	delay(1000);
}

I would not expect it to work on an ESP32 because that only gives out a 3V3 signal. But I would expect it to work on the Mega if it worked in the Uno. Is the code the same? I can't see the code you posted working at all.

Are you sure the order of the pins is the same on each?

Please post a schematic and a photograph of both the Uno and the Mega systems.

Thanks for the fast answere.

As im a new user, i cant upload multiple files at once. So i uploaded them to a cloud:
shorturl.at/kqENS
Or, if this link does not work:
https://we.tl/t-DEY31WGhLL

I hope that this can help.

This is what you need to become not a new user
Restrictions on new posters:-

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