1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
/* * 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 } } |
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: