I can't find the error in my code. Please help
#include <IRremote.h>
#include <Stepper.h>
#define STEPS 2048 // Number of steps per revolution for your stepper motor
#define BUTTON1 0x20DF10EF // IR code for button 1 on your remote
#define BUTTON2 0x20DF906F // IR code for button 2 on your remote
#define BUTTON3 0x20DF50AF // IR code for button 3 on your remote
#define BUTTON4 0x20DFD02F // IR code for button 4 on your remote
const int stepperPins[] = {8, 9, 10, 11}; // Define the pins for your stepper motor
const int enablePin = 12; // Enable pin for the L293D motor drive shield
const int motor1Pin1 = 4; // First input pin for DC motor 1
const int motor1Pin2 = 5; // Second input pin for DC motor 1
const int motor2Pin1 = 6; // First input pin for DC motor 2
const int motor2Pin2 = 7; // Second input pin for DC motor 2
Stepper myStepper(STEPS, stepperPins[0], stepperPins[1], stepperPins[2], stepperPins[3]); // Create the stepper motor object
IRrecv irrecv(3); // Define the IR receiver pin
decode_results results; // Create a variable to store the IR code results
void setup() {
Serial.begin(9600); // Start serial communication
irrecv.enableIRIn(); // Start the IR receiver
pinMode(enablePin, OUTPUT); // Set the enable pin as output
digitalWrite(enablePin, LOW); // Disable the L293D motor driver
pinMode(motor1Pin1, OUTPUT); // Set the input pins for DC motor 1 as output
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT); // Set the input pins for DC motor 2 as output
pinMode(motor2Pin2, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) { // Check if there is an IR code received
Serial.println(results.value, HEX); // Print the IR code in hexadecimal format
irrecv.resume(); // Receive the next IR code
// Check which button is pressed
if (results.value == BUTTON1) {
// Rotate the stepper motor left 45 degrees
digitalWrite(enablePin, HIGH); // Enable the L293D motor driver
myStepper.setSpeed(100); // Set the motor speed in RPM
myStepper.step(-STEPS/8); // Rotate the motor 45 degrees to the left
digitalWrite(enablePin, LOW); // Disable the L293D motor driver
}
else if (results.value == BUTTON2) {
// Rotate DC motor 1 clockwise
digitalWrite(motor1Pin1, HIGH); // Set input pins for DC motor 1
digitalWrite(motor1Pin2, LOW);
}
else if (results.value == BUTTON3) {
// Rotate the stepper motor right 45 degrees
digitalWrite(enablePin, HIGH); // Enable the L293D motor driver
myStepper.setSpeed(100); // Set the motor speed in RPM