Advertisement
adduxa

Microlab Solo 6C IR repeater on Arduino

Jan 29th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.71 KB | None | 0 0
  1. //IR repeater for Microlab Solo 6C
  2. //
  3. //Created by adduxa
  4. //Thanks to http://ex.uz/2013/09/microlab-remote-control-s4/
  5. //
  6. //It works for Arduino Starter kit's remote from Ebay
  7. //Connect IR led's "+" to pin 3 (it can not be reassigned)
  8. //Connect IR reciever to pin 2 (can be reassigned by RECV_PIN constant)
  9.  
  10. #include <IRremote.h>
  11.  
  12. const int RECV_PIN = 2;
  13.  
  14. IRrecv irrecv(RECV_PIN);
  15.  
  16. decode_results results;
  17.  
  18. IRsend irsend;
  19.  
  20. void setup()
  21. {
  22.   Serial.begin(9600);
  23.   irrecv.enableIRIn();
  24. }
  25.  
  26. void loop()
  27. {
  28.   if (irrecv.decode(&results)) {
  29.     switch (results.value) {
  30.       case 16580863: //ON/OFF
  31.         irsend.sendNEC(0x807F40BF, 32); //mute
  32.         Serial.println("ON/OFF");
  33.         break;
  34.       case 16613503: //VOL+
  35.         irsend.sendNEC(0x807F8877, 32); //v+
  36.         Serial.println("VOL+");
  37.         break;
  38.       case 16597183: //FUNC/STOP
  39.         irsend.sendNEC(0x807F20DF, 32); //input
  40.         Serial.println("FUNC/STOP");
  41.         break;
  42.       case 16589023: //PREV
  43.         irsend.sendNEC(0x807F50AF, 32); //b+
  44.         Serial.println("PREV");
  45.         break;
  46.       case 16621663: //PLAY/PAUSE
  47.         Serial.println("PLAY/PAUSE");
  48.         break;
  49.       case 16605343: //NEXT
  50.         irsend.sendNEC(0x807F906F, 32); //t+
  51.         Serial.println("NEXT");
  52.         break;
  53.       case 16584943: //DOWN
  54.         irsend.sendNEC(0x807F708F, 32); //b-
  55.         Serial.println("DOWN");
  56.         break;
  57.       case 16617583: //VOL-
  58.         irsend.sendNEC(0x807F08F7, 32); //v-
  59.         Serial.println("VOL-");
  60.         break;
  61.       case 16601263: //UP
  62.         irsend.sendNEC(0x807FB04F, 32); //t-
  63.         Serial.println("UP");
  64.         break;
  65.       case 16625743: //EQ
  66.         Serial.println("EQ");
  67.         break;
  68.       case 16609423: //ST/REPT
  69.         irsend.sendNEC(0x807F10EF, 32); //reset
  70.         Serial.println("ST/REPT");
  71.         break;
  72.       case 16593103: //0
  73.         Serial.println("0");
  74.         break;
  75.       case 16582903: //1
  76.         Serial.println("1");
  77.         break;
  78.       case 16615543: //2
  79.         Serial.println("2");
  80.         break;
  81.       case 16599223: //3
  82.         Serial.println("3");
  83.         break;
  84.       case 16591063: //4
  85.         Serial.println("4");
  86.         break;
  87.       case 16623703: //5
  88.         Serial.println("5");
  89.         break;
  90.       case 16607383: //6
  91.         Serial.println("6");
  92.         break;
  93.       case 16586983: //7
  94.         Serial.println("7");
  95.         break;
  96.       case 16619623: //8
  97.         Serial.println("8");
  98.         break;
  99.       case 16603303: //9
  100.         Serial.println("9");
  101.         break;
  102.       default:
  103.         Serial.println(results.value);
  104.     }
  105.     irrecv.resume();
  106.     irrecv.enableIRIn(); //Some workaround cause IRsend crash IRrecv
  107.   }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement