Advertisement
Tarielect

Rc5Decoder

Jul 20th, 2018
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. //************************************************************************
  2. //  Name     : Rc5Decoder                                                *
  3. //  Author   : Tarilayefa Edward                                         *
  4. //  Notice   : Copyright (c) 2017                                        *
  5. //           : Tari Electronics & Embedded Systems (TEES)                *
  6. //           : tarielectronics@yahoo.com                                 *
  7. //           : tariembeddedsys@gmail.com                                 *
  8. //  Date     : 25/07/2017                                                *
  9. //  Version  : 1.0                                                       *
  10. //  Notes    : An rc5 ir remote control decoder program to decode        *
  11. //           : philips infra-red remote controls and display button      *
  12. //           : address and commands on serial terminal.                  *
  13. //  Compiler : Arduino 1.8.1                                             *
  14. //  Target   : Atmega 328, Arduino Uno, Nano etc.                        *
  15. //************************************************************************
  16.  
  17. # include <RC5.h> //include rc5 library
  18.  
  19. int IR_PIN = A3;  //ir remote sensor pin
  20. unsigned long t0;
  21. RC5 rc5(IR_PIN);
  22.  
  23. void setup() {                
  24.   Serial.begin(9600);
  25.   Serial.println("Starting");
  26. }
  27.  
  28. void loop() {
  29.   unsigned char toggle;
  30.   unsigned char address;
  31.   unsigned char command;
  32.   if (rc5.read(&toggle, &address, &command))
  33.   {
  34.     Serial.print("address:");
  35.     Serial.print(address);
  36.     Serial.print(" command:");
  37.     Serial.print(command);
  38.     Serial.print(" toggle:");
  39.     Serial.println(toggle);
  40.   }
  41.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement