/* * IRremote: IRreceiveDemo - demonstrates receiving IR codes with IRrecv * An IR detector/demodulator must be connected to the input RECV_PIN. * Initially coded 2009 Ken Shirriff http://www.righto.com/ * Roee Bloch Improved for Arduino UNO with LCD (LCD Keypad shield) * connect IR Receiver to Pin 11 * IR connection from Front OUT - GND - VCC * * -1 UNKNOWN 0 UNUSED (estimation) 1 RC5 2 RC6 3 NEC 4 SONY 5 PANASONIC 6 JVC 7 SAMSUNG (estimation) 8 WHYNTER 9 AIWA_RC_T501 10 LG 11 SANYO (estimation) 12 MITSUBISHI (estimation) 13 DISH (estimation) 14 SHARP (estimation) 15 DENON (estimation) 16 PRONTO (estimation) 17 LEGO_PF (estimation) */ #include <IRremote.h> #include <LiquidCrystal.h>// include the library code /**********************************************************/ char array1[]=" SunFounder "; //the string to print on the LCD char array2[]="hello, world! "; //the string to print on the LCD int tim = 500; //the value of delay time // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); /******************************************* * */ decode_results results; String mystring = String(30); long lastNum; int IR_RECEIVE_PIN = 11; IRrecv IrReceiver(IR_RECEIVE_PIN); void setup() { pinMode(LED_BUILTIN, OUTPUT); lcd.begin(16, 2); lcd.clear(); lcd.setCursor(0,0); lcd.print("By Roee Bloch"); delay(2000); Serial.begin(115200); #if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) delay(2000); // To be able to connect Serial monitor after reset and before first printout #endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ " from " __DATE__)); // In case the interrupt driver crashes on setup, give a clue // to the user what's going on. Serial.println("Enabling IRin"); IrReceiver.enableIRIn(); // Start the receiver IrReceiver.blink13(true); // Enable feedback LED Serial.print(F("Ready to receive IR signals at pin ")); Serial.println(IR_RECEIVE_PIN); } void loop() { if (IrReceiver.decode(&results)) { Serial.println(results.decode_type); Serial.println(results.value, HEX); // dump(&results); lcd.clear(); lcd.setCursor(0,0); switch(results.decode_type) { case 1: lcd.print("RC5"); break; case 2: lcd.print("RC6"); break; case 3: lcd.print("NEC"); break; case 4: lcd.print("SONY"); break; case 5: lcd.print("Type: PANASONIC"); break; case 6: lcd.print("JVC"); break; case 7: lcd.print("SAMSUNG"); break; case 8: lcd.print("WHYNTER"); break; case 9: lcd.print("LG"); break; case 10: lcd.print("LG"); break; case 11: lcd.print("SANYO"); break; case 12: lcd.print("Philips"); break; case 13: lcd.print("SAMSUNG"); break; case 14: lcd.print("SHARP"); break; case 15: lcd.print("DENON"); break; case 16: lcd.print("PRONTO"); break; case 17: lcd.print("LEGO_PF"); break; default: lcd.print("Type: Unknown"); } // lcd.print(results.decode_type); lcd.setCursor(0,1); // lcd.print(results.value); if (results.value != 0xFFFFFFFF ) { lastNum = results.value; lcd.print(results.value,HEX); } else lcd.print(lastNum,HEX); IrReceiver.resume(); // Receive the next value } }Enjoy … this is working, don’t forget to connect IR receiver to Pin 11
To support my site use the links below to order Thanks!
Aliexpress Arduino Nano: https://bit.ly/3953j2p
Arduino Pro mini: https://bit.ly/2XdXfiL
Arduino Uno: https://bit.ly/3orcm4s
Arduino Mega: https://bit.ly/2Mzodix
Arduino Shield LCD: https://bit.ly/2XgeqQB
Arduino Micro: https://bit.ly/2LtGn4F
Arduino Leonardo: https://bit.ly/3njYtU4
Amazon: Arduino Uno: https://amzn.to/35jkxIu
Arduino Pro mini: https://amzn.to/3hUVr7J
Arduino Nano: https://amzn.to/35g5IX2
Arduino Mega: https://amzn.to/2KZ5DAg
Arduino LCD shield: https://amzn.to/3opHVvi
Arduino Micro: https://amzn.to/3pVHs4e
Arduino Leonardo: https://amzn.to/2Xj5J8h
You can download my file here:
Can also download transmitter code here: