/* Program written by: R Jordan Kreindler Date: Dec 11, 2020 Sketch decodes values on IR remote Results are displayed on the Serial Monito */ // Include the built-in library IRremote by Ken Shiffiff #include //Establish IR receiver pin byte receiverPin = 6; // Create the IR receiver object // Here I use the name IRReceiver IRrecv IRReceiver(receiverPin); // Store the results of our // receive value in results decode_results results; unsigned long IRValueReceived; void setup() { // Start the Serial Monitor // at 9600 baud Serial.begin(9600); // Enable the timer interrupt IRReceiver.enableIRIn(); } void loop() { if (IRReceiver.decode(&results)) { // Execute when an IR signal is received IRValueReceived = results.value; Serial.print("Remote type "); if (results.decode_type == 3) { Serial.print("IR for Arduino, Yamaha, Roku, NEC, or Other: "); } else if (results.decode_type == 4) { Serial.print("Sony: "); } else if (results.decode_type == 7) { Serial.print("Samsung: "); } else { Serial.print("Unknown: "); } if (IRReceiver.decode(&results)) { // Execute when an IR signal is received Serial.println(); // Print IR value in Decimal Serial.print(IRValueReceived); Serial.println("\t\t\t Decimal"); // Print IR value in Binary Serial.print(IRValueReceived, BIN); Serial.println("\t Binary"); // Print IR value in Hexadecimal Serial.print(IRValueReceived, HEX); Serial.println("\t\t\t Hexadecimal"); Serial.println("Code Value of Key Pressed"); Serial.println("-----"); IRReceiver.resume(); } } }