IR Remote Control

IR Remote Control

This page is to Setup and Config IR Remote Control

Hardware and Software

Hardware

IR Remote Control

Software

Arduino IDE

Driver Download : https://github.com/z3t0/Arduino-IRremote

Sanki Notes

    • IR Remote

Examples

This example is ..........

          1. /* YourDuino.com Example Software Sketch

          2. IR Remote Kit Test

          3. Uses YourDuino.com IR Infrared Remote Control Kit 2

          4. http://arduino-direct.com/sunshop/index.php?l=product_detail&p=153

          5. based on code by Ken Shirriff - http://arcfn.com

          6. Get Library at: https://github.com/shirriff/Arduino-IRremote

          7. Unzip folder into Libraries. RENAME folder IRremote

          8. terry@yourduino.com */

          9. /*-----( Import needed libraries )-----*/

          10. #include "IRremote.h"

          11. /*-----( Declare Constants )-----*/

          12. int receiver = A0; // pin 1 of IR receiver to Arduino digital pin 11

          13. /*-----( Declare objects )-----*/

          14. IRrecv irrecv(receiver); // create instance of 'irrecv'

          15. decode_results results; // create instance of 'decode_results'

          16. /*-----( Declare Variables )-----*/

          17. void setup() /*----( SETUP: RUNS ONCE )----*/

          18. {

          19. Serial.begin(9600);

          20. Serial.println("IR Receiver Raw Data + Button Decode Test");

          21. irrecv.enableIRIn(); // Start the receiver

          22. }/*--(end setup )---*/

          23. void loop() /*----( LOOP: RUNS CONSTANTLY )----*/

          24. {

          25. if (irrecv.decode(&results)) // have we received an IR signal?

          26. {

          27. // Serial.println(results.value, HEX); UN Comment to see raw values

          28. translateIR();

          29. irrecv.resume(); // receive the next value

          30. }

          31. }/* --(end main loop )-- */

          32. /*-----( Declare User-written Functions )-----*/

          33. void translateIR() // takes action based on IR code received

          34. // describing Car MP3 IR codes

          35. {

          36. switch(results.value)

          37. {

          38. case 0xFFA25D:

          39. Serial.println(" CH- ");

          40. break;

          41. case 0xFF629D:

          42. Serial.println(" CH ");

          43. break;

          44. case 0xFFE21D:

          45. Serial.println(" CH+ ");

          46. break;

          47. case 0xFF22DD:

          48. Serial.println(" PREV ");

          49. break;

          50. case 0xFF02FD:

          51. Serial.println(" NEXT ");

          52. break;

          53. case 0xFFC23D:

          54. Serial.println(" PLAY/PAUSE ");

          55. break;

          56. case 0xFFE01F:

          57. Serial.println(" VOL- ");

          58. break;

          59. case 0xFFA857:

          60. Serial.println(" VOL+ ");

          61. break;

          62. case 0xFF906F:

          63. Serial.println(" EQ ");

          64. break;

          65. case 0xFF6897:

          66. Serial.println(" 0 ");

          67. break;

          68. case 0xFF9867:

          69. Serial.println(" 100+ ");

          70. break;

          71. case 0xFFB04F:

          72. Serial.println(" 200+ ");

          73. break;

          74. case 0xFF30CF:

          75. Serial.println(" 1 ");

          76. break;

          77. case 0xFF18E7:

          78. Serial.println(" 2 ");

          79. break;

          80. case 0xFF7A85:

          81. Serial.println(" 3 ");

          82. break;

          83. case 0xFF10EF:

          84. Serial.println(" 4 ");

          85. break;

          86. case 0xFF38C7:

          87. Serial.println(" 5 ");

          88. break;

          89. case 0xFF5AA5:

          90. Serial.println(" 6 ");

          91. break;

          92. case 0xFF42BD:

          93. Serial.println(" 7 ");

          94. break;

          95. case 0xFF4AB5:

          96. Serial.println(" 8 ");

          97. break;

          98. case 0xFF52AD:

          99. Serial.println(" 9 ");

          100. break;

          101. default:

          102. Serial.println(" other button ");

          103. }

          104. delay(500);

          105. } //END translateIR

          106. /* ( THE END ) */