Hey programmers!
I am programming a remote controlled stepper motor that when i hold the remote button, it keeps moving. I know that when you hold down a button on the remote, it gives off the hex FFFFFFFF. I want to be able to hold down the button so that it can move forward when i press the up button, and backward when i hold down the down button. Sadly i can only make the hex FFFFFFFF have one value. Can anyone help me?
code:
#include <Stepper.h>
#define STEPS 32
int stepsPerRevolution;
Stepper myStepper(STEPS, 8,9,10,11);
int remotePin = 6;
IRrecv IR(remotePin);
decode_results cmd;
void setup() {
Serial.begin(9600);
IR.enableIRIn();
}
void loop() {
if (IR.decode(&cmd)) {
switch(cmd.value){
case 0xFF629D:
myStepper.setSpeed(500);
stepsPerRevolution = 2048;
myStepper.step(70);
break;
case 0xFFFFFFFF:
myStepper.setSpeed(500);
stepsPerRevolution = 2048;
myStepper.step(70);
break;
case 0xFFA857:
myStepper.setSpeed(500);
stepsPerRevolution = -2048;
myStepper.step(70);
break;
}
IR.resume();
}
}