Hello.
I have a project that I built with a 28BYJ-48 Step Motor on it. I have a basic Xinda IR remote that I have with it. I am trying to use 12 of the keys on the remote to move the Step Motor to 12 different spots. ( basically just like the 12 spots on a clock )
My code is working with the remote but I cant seem to get the Step motor to move in different spots when I touch the remote buttons.
Is there a simple way to just digital write the step motor to each spot?
Is there a way to loop the digital write compared to how far each spot is from the step motor starting point?
Any help is greatly appreciated. THANKS
[/#include <IRremote.h>
const int a1 = 8;Â Â // Stepper Motor IN1
const int a2 =Â 9;Â Â // Stepper Motor IN2
const int b1 =Â 10;Â Â // Stepper Motor IN3
const int b2 =Â 11;Â Â // Stepper Motor IN4
int RECV_PIN = 12;
 IRrecv irrecv(RECV_PIN);
 decode_results results;
void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
Â
 pinMode(a1, OUTPUT);
 pinMode(a2, OUTPUT);
 pinMode(b1, OUTPUT);
 pinMode(b2, OUTPUT);
Â
 digitalWrite(a1, LOW);
 digitalWrite(a2, LOW);
 digitalWrite(b1, LOW);
 digitalWrite(b2, LOW);
}
void loop() {
Â
  if (irrecv.decode(&results)) {
  if(results.value==0xff629d){
   Serial.println("UP = No Function");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff22dd){
   Serial.println("LEFT = No Function");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xffc23d){
   Serial.println("RIGHT = No Function");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff02fd){
   Serial.println("OK = No Function");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xFF6897){
   Serial.println("1 = Move to position 1");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xFF9867){
   Serial.println("2 = Move to position 2");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  if(results.value==0xffB04F){
   Serial.println("3 = Move to position 3");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff30CF){
   Serial.println("4 = Move to position 4");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xFF18E7){
   Serial.println("5 = Move to position 5");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff7A85){
   Serial.println("6 = Move to position 6");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff10EF){
   Serial.println("7 = Move to position 7");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff38C7){
   Serial.println("8 = Move to position 8");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff5AA5){
   Serial.println("9 = Move to position 9");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
 if(results.value==0xff4AB5){
   Serial.println("0 = Move to position 10");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff42BD){
   Serial.println("* = Move to position 11");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  }
  if(results.value==0xff52AD){
   Serial.println("# = Move to position 12");
  Â
   //....MOVE STEPPER MOTOR???
  Â
   delay(25);
  Â
  }
  irrecv.resume(); // Receive the next value
 }
} code]