Thumbnail for video 'Programming ESP32 with Arduino - Using IR Receiver (HX1838) + Remote Control'

← Back to courses

Using IR Receiver (HX1838) + Remote Control

Control your ESP32 projects with an infrared remote control. They're cheap & easy to use.

By using a remote, you can replace physical buttons, and enjoy controlling your projects from distance.

Useful resources

Wiring diagram:

Wiring for HX1838 IR receiver Wiring for HX1838 IR receiver

Full code used in this video:

#include <Arduino.h>
#include <IRremote.h>

#define RECEIVER_PIN 5
IRrecv receiver(RECEIVER_PIN);
decode_results results;

void setup(){

void loop(){
if (receiver.decode(&results)){
Serial.println(results.value, HEX);

// Up arrow pressed
if(results.value == 0xFF906F){
digitalWrite(LED_BUILTIN, LOW);

// Down arrow pressed
if(results.value == 0xFFE01F){
digitalWrite(LED_BUILTIN, HIGH);