IR Reader 1.0 (Teensy & Arduino)

3 comments Escrito el 12 de febrero del 2011 por
Categorias: Teensy 2.0

Un sencillo lector de códigos IR en Hexadecimal con una placa Teensy 2.0 o arduino ( IDE 0022 ). Se podría llegar a modificar de manera que añadiendo un LED IR y algún botón más, guardar el código recibido y emitirlo de nuevo pudiendo hacer asta un mando programable para controlar todos los aparatos con un solo mando.

Código fuente

#include <LiquidCrystal.h>
#include <IRremote.h>
int RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;
LiquidCrystal lcd(12, 13, 14, 15, 16, 17);
byte ico1[8] = {B00000,B00001,B10001,B01001,B00101,B00000,B00011,B00111};
byte ico2[8] = {B00000,B00000,B00000,B00000,B00000,B00000,B00011,B00111};
byte ico3[8] = {B00000,B10000,B10001,B10010,B10100,B00000,B11000,B11100};
byte ico4[8] = {B00000,B00000,B00000,B00000,B00000,B00000,B11000,B11100};

void setup() {
  lcd.createChar(0, ico1);
  lcd.createChar(1, ico2);
  lcd.createChar(2, ico3);
  lcd.createChar(3, ico4);
  lcd.begin(16, 2);
  lcd.print("IR Reader 1.0");
  lcd.setCursor(0, 1);
  lcd.print("www.ardublog.com");
  delay(1500);
  lcd.clear();
  lcd.print("IR Reader 1.0");
  Serial.begin(9600);
  irrecv.enableIRIn();
}

void loop() {
  lcd.setCursor(14, 0);
  lcd.write(0);
  lcd.write(2);
  delay(500);
  lcd.setCursor(14, 0);
  lcd.write(1);
  lcd.write(3);
  delay(500);
if (irrecv.decode(&results)) {
  lcd.setCursor(0, 1);
  if (results.decode_type == NEC) {
      lcd.print("NEC: ");
    } else if (results.decode_type == SONY) {
      lcd.print("SONY: ");
    } else if (results.decode_type == RC5) {
      lcd.print("RC5: ");
    } else if (results.decode_type == RC6) {
      lcd.print("RC6: ");
    } else if (results.decode_type == UNKNOWN) {
      lcd.print("?: "); // Desconocido (UNKNOWN)
    }
  lcd.print(results.value, HEX);
  lcd.print(" "); // Para limpiar
  irrecv.resume();
  }
}

Library

IRremote.h (29 KB)

Tags: , , , , , , , ,

3 comments “IR Reader 1.0 (Teensy & Arduino)”

How can I reduce belly bodyweight?

That’s a smart answer to a dilcufift question.

Oraindik ez dut ulertzen zergatik Elexpururen lan ‘filologikoa’ aintzat hartu daitekeen, baina Lakarra eta Gorrotxategirena ez. Elexpuruk esaten duena: “Lakarrak esaten du hau ez dela posible honegatik eta honegatik, baina gure ustez posible da!” Elexpururen lana ez zait iruditzen ez zientifikoa eta ez filologikoa.


Leave a Reply