Hello, I need your help guys, I want to control 2 stepper motors with the +/- button of a IR Remote, but it looks like the steppers are moving just one step at the time when I push the + or - of the remote, do you know why?
#include <AccelStepper.h>
#include <IRremote.h>
AccelStepper stepper1(AccelStepper::FULL4WIRE, 8, 9, 10, 11);
AccelStepper stepper2(AccelStepper::FULL4WIRE, 4, 5, 6, 7);
int receiver = 12; //IR reciever pin
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
void setup()
{
Serial.begin(9600);
stepper1.setMaxSpeed(300.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(2048);
stepper2.setMaxSpeed(300.0);
stepper2.setAcceleration(100.0);
stepper2.moveTo(-2048);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
switch(results.value)
{
case 0xFF629D: // UP button pressed
stepper1.run();
stepper2.run();
break;
case 0xFFA857: // DOWN button pressed
stepper1.run();
stepper2.run();
break;
}
irrecv.resume(); // receive the next value
}
}