The stepper motor does not work and beeps, there are 3 buttons, according to the idea: 1 drives the engine to the right, 2 stops it, 3 drives the engine to the left. And he's just beeping. It does not respond to the buttons, everything is connected correctly, I just checked. The code below
#include <Stepper.h>
// Определение количества шагов на оборот у вашего шагового двигателя
const int stepsPerRevolution = 2048;
// Указываем пины для подключения к драйверу ULN2003
const int in1 = 8;
const int in2 = 9;
const int in3 = 10;
const int in4 = 11;
// Инициализация объекта Stepper
Stepper myStepper(stepsPerRevolution, in1, in2, in3, in4);
void setup() {
// Установка скорости двигателя (может потребоваться настройка)
myStepper.setSpeed(100);
// Настройка пинов для кнопок как входов
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
}
void loop() {
if (digitalRead(2) == HIGH) { // Если кнопка 1 нажата
myStepper.step(stepsPerRevolution); // Двигаем мотор вправо на один шаг
} else if (digitalRead(3) == HIGH) { // Если кнопка 2 нажата
// Останавливаем двигатель
myStepper.step(0);
} else if (digitalRead(4) == HIGH) { // Если кнопка 3 нажата
myStepper.step(-stepsPerRevolution); // Двигаем мотор влево на один шаг
}
}
What Arduino controller are you using?
What stepper controller are you using?
What are you using as a power supply?
Can you please post a link to data/specs of the stepper?
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.