Misc files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gherkin_remote.ino 4.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #include "Adafruit_Keypad.h"
  2. #include <IRremote.h>
  3. const byte ROWS = 6; // rows
  4. const byte COLS = 5; // columns
  5. //define weird Gherkin key layout
  6. byte keys[ROWS][COLS] = {
  7. {30, 12, 23, 5, 16},
  8. {27, 9, 20, 2, 13},
  9. {24, 6, 17, 28, 10},
  10. {21, 3, 14, 25, 7},
  11. {18, 29, 11, 22, 4},
  12. {15, 26, 8, 19, 1}
  13. };
  14. // Physical Gherkin layout
  15. // 1 2 3
  16. // 4 5 6
  17. // 7 8 9
  18. // 10 11 12
  19. // 13 14 15
  20. // 16 17 18
  21. // 19 20 21
  22. // 22 23 24
  23. // 25 26 27
  24. // 28 29 30
  25. byte rowPins[ROWS] = {3, 4, 5, 6, 7, 8}; //connect to the row pinouts of the keypad
  26. byte colPins[COLS] = {10, 16, 14, 15, 18}; //connect to the column pinouts of the keypad
  27. //initialize an instance of class NewKeypad
  28. Adafruit_Keypad customKeypad = Adafruit_Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);
  29. IRsend irsend;
  30. void setup() {
  31. // Serial.begin(9600);
  32. customKeypad.begin();
  33. }
  34. void loop() {
  35. // put your main code here, to run repeatedly:
  36. customKeypad.tick();
  37. //Codes for the Visio TV
  38. //Power A Input 20DF10EF 20DF4AB5 20DFF40B
  39. //Home Up Menu 20DFB44B 20DFA25D 20DFF20D
  40. //Left OK Right 20DFE21D 20DF22DD 20DF12ED
  41. //Back Down Star 20DF52AD 20DF629D 20DFD827
  42. //Vol + Mute Channel + 20DF40BF 20DF906F 20DF00FF
  43. //Vol - Previous Channel - 20DFC03F 20DF58A7 20DF807F
  44. //1 2 3 20DF8877 20DF48B7 20DFC837
  45. //4 5 6 20DF28D7 20DFA857 20DF6897
  46. //7 8 9 20DFE817 20DF18E7 20DF9867
  47. //. 0 Enter 20DFFF00 20DF08F7 20DF5CA3
  48. while (customKeypad.available()) {
  49. keypadEvent e = customKeypad.read();
  50. if ((e.bit.KEY == 1) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF10EF, 32);
  51. if ((e.bit.KEY == 2) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF4AB5, 32);
  52. if ((e.bit.KEY == 3) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFF40B, 32);
  53. if ((e.bit.KEY == 4) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFB44B, 32);
  54. if ((e.bit.KEY == 5) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFA25D, 32);
  55. if ((e.bit.KEY == 6) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFF20D, 32);
  56. if ((e.bit.KEY == 7) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFE21D, 32);
  57. if ((e.bit.KEY == 8) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF22DD, 32);
  58. if ((e.bit.KEY == 9) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF12ED, 32);
  59. if ((e.bit.KEY == 10) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF52AD, 32);
  60. if ((e.bit.KEY == 11) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF629D, 32);
  61. if ((e.bit.KEY == 12) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFD827, 32);
  62. if ((e.bit.KEY == 13) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF40BF, 32);
  63. if ((e.bit.KEY == 14) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF906F, 32);
  64. if ((e.bit.KEY == 15) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF00FF, 32);
  65. if ((e.bit.KEY == 16) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFC03F, 32);
  66. if ((e.bit.KEY == 17) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF58A7, 32);
  67. if ((e.bit.KEY == 18) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF807F, 32);
  68. if ((e.bit.KEY == 19) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF8877, 32);
  69. if ((e.bit.KEY == 20) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF48B7, 32);
  70. if ((e.bit.KEY == 21) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFC837, 32);
  71. if ((e.bit.KEY == 22) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF28D7, 32);
  72. if ((e.bit.KEY == 23) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFA857, 32);
  73. if ((e.bit.KEY == 24) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF6897, 32);
  74. if ((e.bit.KEY == 25) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFE817, 32);
  75. if ((e.bit.KEY == 26) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF18E7, 32);
  76. if ((e.bit.KEY == 27) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF9867, 32);
  77. if ((e.bit.KEY == 28) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DFFF00, 32);
  78. if ((e.bit.KEY == 29) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF08F7, 32);
  79. if ((e.bit.KEY == 30) && (e.bit.EVENT == KEY_JUST_PRESSED)) irsend.sendNEC(0x20DF5CA3, 32);
  80. }
  81. delay(10);
  82. }