유은제gledel
Published

Text LCD Display & infrared remote LED ON/OFF

Use the LCD display and infrared remote to turn on and off the LED

IntermediateProtip4,845
Text LCD Display & infrared remote LED ON/OFF

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
JustBoom IR Remote
JustBoom IR Remote
×1
Power MOSFET N-Channel
Power MOSFET N-Channel
×1
LED (generic)
LED (generic)
×2
Resistor 221 ohm
Resistor 221 ohm
×2
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Jumper wires (generic)
Jumper wires (generic)
×23

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

schemetics of text LCD display and IRremote LED on/off

Code

code of text LCD display and IRremote LED(on/off)

EJS
#include <IRremote.h>
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;
int led_pin1 = 6;
int led_pin2 = 7;
int led_state1 = 0;
int led_state2 = 0;
#define code1 16724175
#define code2 16718055
 
void setup()
{
  irrecv.enableIRIn(); 
  lcd.begin(16, 2);
  pinMode(led_pin1, OUTPUT);
  pinMode(led_pin2, OUTPUT);
  lcd.setCursor(0,0);
  lcd.print("1 : LED1 ON/OFF");
  lcd.setCursor(0,1);
  lcd.print("2 : LED2 ON/OFF");
}
 
void loop() {
if (irrecv.decode(&results)) {
  unsigned int value = results.value;
  switch (value) {
  case code1 :
    lcd.setCursor(0,0);
    if(led_state1 == 1){
    digitalWrite(led_pin1, LOW);
    lcd.print("LED1 is OFF     ");
    led_state1 = 0;
    }
    else{
      digitalWrite(led_pin1, HIGH);
      lcd.print("LED1 is ON      ");
      led_state1 = 1;
    }
    break;
  case code2 :
    lcd.setCursor(0,1);
    if(led_state2 == 1){
    digitalWrite(led_pin2, LOW);
    lcd.print("LED2 is OFF     ");
    led_state2=0;
    }
    else{
      digitalWrite(led_pin2, HIGH);
      lcd.print("LED2 is ON      ");
      led_state2=1;
    }
    break;
    }
    irrecv.resume(); 
}
}

Credits

유은제
15 projects • 13 followers
Hello :-) I'm a high school student in South Korea.
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"

Comments