04 March 2026

Ignacio Vergara - Communication

 

 

 

Communication

Description

For this project I used two different inputs and one output. The output is a 16x2 LCD screen, and the inputs are an IR remote control with its receiver and a potentiometer. The goal of the project was to show how a wireless device can send input that is then displayed on a screen.

The IR receiver reads the signal from the remote control and sends it to the Arduino. Each button on the remote produces a different hexadecimal code. In the program I decode those signals and map them to numbers. When a button is pressed, the Arduino recognizes the code and prints the corresponding number on the LCD screen.

 Video Demonstration

 



 Photos









 Sketch

 

Schematic





Code


#include <LiquidCrystal.h>
#include <IRremote.h>

#define IR_RECEIVE_PIN 6

LiquidCrystal lcd(7,8,9,10,11,12);

void setup() {
  lcd.begin(16,2);
  lcd.print("Press a number");

  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
  Serial.begin(9600);
}

void loop() {

  if (IrReceiver.decode()) {

    //Print codes of each number
    //Serial.print("Code: ");
    //Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);

    // stores the code corresponding to each button
    unsigned long code = IrReceiver.decodedIRData.decodedRawData;

    char number = getNumber(code);

    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("You just pressed: ");

    lcd.setCursor(0,1);
    lcd.print(number);

    IrReceiver.resume();
  }
}

char getNumber(unsigned long code) {

  if (code == 0xF30CFF00) return '1';
  if (code == 0xE718FF00) return '2';
  if (code == 0xA15EFF00) return '3';
  if (code == 0xF708FF00) return '4';
  if (code == 0xE31CFF00) return '5';
  if (code == 0xA55AFF00) return '6';
  if (code == 0xBD42FF00) return '7';
  if (code == 0xAD52FF00) return '8';
  if (code == 0xB54AFF00) return '9';
  if (code == 0xE916FF00) return '0';
}



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.