Skip to content

Instantly share code, notes, and snippets.

@sundararajana
Last active August 29, 2015 14:19
Show Gist options
  • Save sundararajana/c4270acb26c63e8c42fb to your computer and use it in GitHub Desktop.
Save sundararajana/c4270acb26c63e8c42fb to your computer and use it in GitHub Desktop.
Simple #Induino R3 #arduino board example to work with LCD and IR remote
// Simple example to read IR remote key and show it on LCD
// using Induino R3 board, LCD shield and Sony IR remote.
// See also:
//
// InduinoX libraries and samples download here:
// http://downloads.simplelabs.co.in/induinox_samples.zip
//
// Interfacing LED shield:
// http://induino.blogspot.in/2012/03/induinox-user-guide-interfacing-with.html
//
// Working with IR remote:
// http://induino.blogspot.in/2011/12/induinox-user-guide-working-with-tsop.html
//
// There seems to be updated tutorial @
// http://www.induino.com/
// This is from Induino IRremote library
// This is NOT the RobotIRremote from arduino 1.6.3!
// You'll get multiple libraries "IRremote.h" warning! Ignore it.
#include <IRremote.h>
#include <IRremoteInt.h>
// include the library code:
#include <LiquidCrystal.h>
int RECV_PIN = 15;
IRrecv irrecv(RECV_PIN);
decode_results results;
// initialize the library with the numbers of the interface pins
// LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd(8,9,10,11,12,13);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
irrecv.enableIRIn(); // Start the Remote receiver
}
void loop() {
// get value from IR remote and show it on LCD screen
if (irrecv.decode(&results)) {
lcd.setCursor(1, 0);
int i;
// map values for Sony remote
switch(results.value) {
case 2320:
i = 0;
break;
case 16:
i = 1;
break;
case 2064:
i = 2;
break;
case 1040:
i = 3;
break;
case 3088:
i = 4;
break;
case 528:
i = 5;
break;
case 2576:
i = 6;
break;
case 1552:
i = 7;
break;
case 3600:
i = 8;
break;
case 272:
i = 9;
break;
default:
// some other non-numeric key
// just show whatever comes on second row of LCD screen
lcd.setCursor(1, 1);
i = results.value;
break;
}
lcd.print(i);
delay(300); // small delay to avoid debounce
irrecv.resume(); // Receive the next value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment