Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Install library
- //http://pastebin.com/kNMMxkkk
- //For computer side of things http://pastebin.com/PXCbLKNj
- //------------------------------------------------------------------------------
- // Include the IRremote library header
- //
- #include <IRremote.h>
- //------------------------------------------------------------------------------
- // Tell IRremote which Arduino pin is connected to the IR Receiver (TSOP4838)
- //
- int recvPin = 11;
- IRrecv irrecv(recvPin);
- //+=============================================================================
- // Configure the Arduino
- //
- void setup ( )
- {
- Serial.begin(9600); // Status message will be sent to PC at 9600 baud
- irrecv.enableIRIn(); // Start the receiver
- }
- void dumpCode (decode_results *results)
- {
- // All protocols have data
- Serial.print(results->value, HEX);
- Serial.print("\n");
- }
- //+=============================================================================
- // The repeating section of the code
- //
- void loop ( )
- {
- decode_results results; // Somewhere to store the results
- if (irrecv.decode(&results)) { // Grab an IR code
- dumpCode(&results); // Output the results as source code
- irrecv.resume(); // Prepare for the next value
- }
- }
Add Comment
Please, Sign In to add comment