# Ir Remote to Stepper

**URL:** <https://forum.arduino.cc/t/ir-remote-to-stepper/1429802>\
**Category:** Programming\
**Created:** [February 9, 2026, 12:28am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802 "2026-02-09T00:28:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![spiffy577](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spiffy577/32/1259265_2.png) [@spiffy577](https://forum.arduino.cc/u/spiffy577)\
**Post date:** [February 9, 2026, 12:28am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/1 "2026-02-09T00:28:44Z")

</div>

Hello,

I'm trying to write a simple ir remote to motor program but it doesn't continue while I hold the button down. It just runs the stepper.step once and then stops. Only when I let go of the one button on the remote will it do it again. I want the stepper to continue until I let go of that button. I thought it was the delay at the end of the translateIR function but that didn't work. Should I eliminate the delay?

Thanks,

Josh

```arduino

#include <Stepper.h>
#include "IRremote.h"
int receiver = 5; // Signal Pin of IR receiver to Arduino Digital Pin

/*-----( Declare objects )-----*/
IRrecv irrecv(receiver);
decode_results results;
// create instance of 'irrecv'
// create instance of 'decode_results'
// Define motor pins connected to ULN2003 driver
#define MP1 8 // IN1 on the ULN2003
#define MP2 9 // IN2 on the ULN2003
#define MP3 10 // IN3 on the ULN2003
#define MP4 11 // IN4 on the ULN2003

#define SPR 2048 // Steps per revolution (for 28BYJ-48 stepper motor)
int homePos = 1024;
int loc=0;
// Create Stepper object
Stepper stepper(SPR, MP1, MP3, MP2, MP4);
void translateIR() // takes action based on IR code received

// describing Remote IR codes 

{

  switch(results.value)

  {
  case 0xFFA25D: Serial.println("POWER"); break;
  case 0xFFE21D: Serial.println("VOL STOP"); break;
  case 0xFF629D: Serial.println("MODE"); break;
  case 0xFF22DD: Serial.println("PAUSE"); break;
  case 0xFF02FD: Serial.println("FAST BACK"); break;
  case 0xFFC23D: Serial.println("FAST FORWARD"); break;
  case 0xFFE01F: Serial.println("EQ"); break;
  case 0xFFA857: Serial.println("VOL-"); break;
  case 0xFF906F: Serial.println("VOL+"); break;
  case 0xFF9867: Serial.println("RETURN"); break;
  case 0xFFB04F: Serial.println("USB SCAN"); break;
  case 0xFF6897: Serial.println("0"); break;
  case 0xFF30CF: Serial.println("1"); stepper.step(1000); break;
  case 0xFF18E7: Serial.println("2"); stepper.step(-1000) break;
  case 0xFF7A85: Serial.println("3"); break;
  case 0xFF10EF: Serial.println("4"); break;
  case 0xFF38C7: Serial.println("5"); break;
  case 0xFF5AA5: Serial.println("6"); break;
  case 0xFF42BD: Serial.println("7"); break;
  case 0xFF4AB5: Serial.println("8"); break;
  case 0xFF52AD: Serial.println("9"); break;
  case 0xFFFFFFFF: Serial.println(" REPEAT");break;  

  default: 
    Serial.println(" other button ");

  }// End Case

  delay(10); // Do not get immediate repeat

} //END translateIR

void setup() 
{
  Serial.begin(9600);
  // Set motor speed
  // Set speed to 10 RPM
  
// HAVE TO SET STEPPER SPEED HERE
stepper.setSpeed(10);

  irrecv.enableIRIn();
  Serial.begin(9600);
 }

void loop()  
{
if (irrecv.decode(&results)) // have we received an IR signal?

  {
    translateIR(); 
    irrecv.resume(); // receive the next value
  }  
} 

```

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [February 9, 2026, 1:10am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/2 "2026-02-09T01:10:29Z")

</div>

Just a hunch, but your code looks strange. Try starting with one of the examples for the library.

 ![Screenshot 2026-02-08 at 20.08.56](https://europe1.discourse-cdn.com/arduino/original/4X/1/7/2/172cf9e72b15fa4c1eee002ffce890ce98825678.jpeg)

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [February 9, 2026, 1:23am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/3 "2026-02-09T01:23:27Z")

</div>

```arduino
case 0xFF18E7: Serial.println("2"); stepper.step(-1000) break;

```

```arduino
case 0xFF18E7: 
Serial.println("2");  
stepper.step(-1000) // <-----<<<<< You need a semicolon.
break;

```

* * *

- Which IR remote are you using ?

- Do you have the latest IR remote library installed ?  
**4.4.0 or newer**

---

<div class="post-metadata">

**Author:** ![spiffy577](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/spiffy577/32/1259265_2.png) [@spiffy577](https://forum.arduino.cc/u/spiffy577)\
**Post date:** [February 9, 2026, 1:49am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/4 "2026-02-09T01:49:34Z")

</div>

This is from a RexQualis kit. I don't think it is using the latest library since the kit is so old. Is there a way to fix this?

I did see it had a repeat case in the switch. I have to check but it seems that will fire if the button is held. I have an update to the code to continue moving fwd or backwards if the repeat is firing. I have to try it.

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [February 9, 2026, 2:10am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/5 "2026-02-09T02:10:23Z")

</div>

```arduino
#include <IRremote.h>

int RECV_PIN = 5; // Pin connected to the IR receiver Signal pin
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX); // Print the hex code of the button
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

```

- What happens when you run the above sketch ?

- Please show us an image of your remote.

* * *

* * *

* * *

- The latest IRremote library that the majority of us use is IRremote version 4.4.0 or 4.5.0

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [February 10, 2026, 4:18am UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/6 "2026-02-10T04:18:10Z")

</div>

> [@spiffy577](#):
>
> if the button is held

A few years ago "repeat" is all "f"s ... 0xffffff... and I remember Shariff was the author.

---

<div class="post-metadata">

**Author:** ![oldcurmudgeon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/oldcurmudgeon/32/1280882_2.png) [@oldcurmudgeon](https://forum.arduino.cc/u/oldcurmudgeon)\
**Post date:** [February 10, 2026, 5:05pm UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/7 "2026-02-10T17:05:36Z")

</div>

What happens when you hold down a button is remote dependent. Some controls send a different command to indicate "repeat last command", others resend the command and some just sent the command once.

Build a test program to see what your control does when you hold down a key. There should be library example programs that do this or are close with a few modifications.

If you have a cheap logic analyzer that would be even faster. Search something like **24mhz 8 channel logic analyzer**. Should be less than $20 at places like Amazon, Aliexpress, Ebay, etc. Totally worth it if you are having any serial protocol (SPI, I2C, serial, IR) problems.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [August 9, 2026, 5:06pm UTC](https://forum.arduino.cc/t/ir-remote-to-stepper/1429802/8 "2026-08-09T17:06:02Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
