Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino MKR WiFi 1010 IR Remote-Controlled LED

View and Edit Project In Cirkit DesignerImage of Arduino MKR WiFi 1010 IR Remote-Controlled LED

Circuit Documentation

Summary

This circuit consists of an Arduino MKR WiFi 1010 microcontroller, a white LED, an HX1838 Infrared (IR) Wireless Remote Control, and a VS1838B IR Receiver. The circuit is designed to control the LED using the IR remote. When a specific button on the remote is pressed, the LED will turn on or off.

Component List

Arduino MKR WiFi 1010

LED: Two Pin (white)

HX1838 Infrared IR Wireless Remote Control

VS1838B IR Receiver

Wiring Details

Arduino MKR WiFi 1010

LED: Two Pin (white)

HX1838 Infrared IR Wireless Remote Control

VS1838B IR Receiver

Code Documentation

Arduino Code

#include <IRremote.h>

const int RECV_PIN = 3; // Pin connected to the OUT pin of VS1838B
const int LED_PIN = 2;  // Pin connected to the anode of the LED

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  pinMode(LED_PIN, OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    // Example: Turn on the LED when the "1" button is pressed
    if (results.value == 0xFFA25D) { // Replace with the actual code for your remote
      digitalWrite(LED_PIN, HIGH);
    } else {
      digitalWrite(LED_PIN, LOW);
    }
    irrecv.resume(); // Receive the next value
  }
}

This code initializes the IR receiver and sets up the LED pin as an output. In the main loop, it checks if an IR signal has been received. If the signal matches the code for the "1" button on the remote, the LED is turned on. Otherwise, the LED is turned off. The irrecv.resume() function is called to prepare the receiver for the next signal.