Загрузка страницы

ARDUINO IR Remote Controlled LEDs -Easy Tutorial

Hello Everyone! In this Video, we will be making a Video on how to Control LEDs using an IR (INFRARED) Remote. I am using a 3 Legged Receiver for this. You can also use the one you get in the Kits where they are on a "Platform" but have 3 legs. Please drop a Like and Subscribe for more amazing tutorials. Hope You Enjoyed! Thanks! *Scroll Down for a Lot more Details*

|Program:|

#include

#define first_key 48703
#define 58359
#define third_key 539
#define fourth_key 25979
int receiver_pin = 10;

int first_led_pin = 7;
int second_led_pin = 6;
int third_led_pin = 5;
int fourth_led_pin = 4;
int led[] = {0,0,0,0};
IRrecv receiver(receiver_pin);
decode_results output;

void setup()
{
Serial.begin(9600);
receiver.enableIRIn();
pinMode(first_led_pin, OUTPUT);
pinMode(second_led_pin, OUTPUT);
pinMode(third_led_pin, OUTPUT);
pinMode(fourth_led_pin, OUTPUT);
}

void loop() {
if (receiver.decode(&output)) {
unsigned int value = output.value;
switch(value) {
case first_key:
if(led[1] == 1) {
digitalWrite(first_led_pin, LOW);
led[1] = 0;
} else {
digitalWrite(first_led_pin, HIGH);
led[1] = 1;
}
break;
case second_key:

if(led[2] == 1) {
digitalWrite(second_led_pin, LOW);
led[2] = 0;
} else {
digitalWrite(second_led_pin, HIGH);
led[2] = 1;
}
break;
case third_key:

if(led[3] == 1) {
digitalWrite(third_led_pin, LOW);
led[3] = 0;
} else {
digitalWrite(third_led_pin, HIGH);
led[3] = 1;
}
break;
case fourth_key:

if(led[4] == 1) {
digitalWrite(fourth_led_pin, LOW);
led[4] = 0;
} else {
digitalWrite(fourth_led_pin, HIGH);
led[4] = 1;
}
break;
}
Serial.println(value);
receiver.resume();
}
}
|Timeline|

0:00 - Introduction
0:11 - Components Required
0:40 - Connecting Power and IR Receiver
1:42 - Connecting LEDs (and Obviously Resistors)
3:15 - Disclaimer about Program Above
3:27 - How It Works
4:34 - TESTING!
5:28 - How Code Works, and The Serial Monitor with all the Numbers (you'll see)

|Components:|

-4 LEDs
-4 Resistors to Pair with the LEDs (I am using 330 ohms)
-Infrared(IR) Remote or TV Remote
-Infrared(IR) 3 legged Receiver
-Jumper Cables/Wires
-Breadboard
-Arduino Uno

Source:https://maker.pro/arduino/tutorial/how-to-control-leds-with-arduino-ir-sensor-and-remote
Thank You For Watching!!! See You Next Time!

Видео ARDUINO IR Remote Controlled LEDs -Easy Tutorial канала CircuitGuru
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
6 июля 2020 г. 5:39:28
00:09:16
Яндекс.Метрика