#include IRsend irsend; int y = 1; void setup() { Serial.begin(9600); } void loop() { if (Serial.available() > 0) { int x = Serial.read(); if (x == 49) { y = 1; } if (x == 50) { y = 2; } if (y == 1) { // коды кнопок для пульта от телевизора if (x == 97) { irsend.sendNEC(0x807F08F7, 32); delay(40); } if (x == 98) { irsend.sendNEC(0x807FA857, 32); delay(40); } if (x == 99) { irsend.sendNEC(0x807F708F, 32); delay(40); } if (x == 100) { irsend.sendNEC(0x807FF00F, 32); delay(40); } if (x == 101) { irsend.sendNEC(0x807F30CF, 32); delay(40); } if (x == 102) { irsend.sendNEC(0x807FB04F, 32); delay(40); } if (x == 103) { irsend.sendNEC(0x807F9867, 32); delay(40); } if (x == 104) { irsend.sendNEC(0x807F58A7, 32); delay(40); } if (x == 105) { irsend.sendNEC(0x807FD827, 32); delay(40); } if (x == 106) { irsend.sendNEC(0x807F38C7, 32); delay(40); } if (x == 107) { irsend.sendNEC(0x807F48B7, 32); delay(40); } if (x == 108) { irsend.sendNEC(0x807FB847, 32); delay(40); } if (x == 109) { irsend.sendNEC(0x807F6897, 32); delay(40); } } if (y == 2) { //коды кнопок пульта от медиаплеера if (x == 97) { irsend.sendNEC(0xFDC23D, 32); delay(40); } if (x == 98) { irsend.sendNEC(0xFDE01F, 32); delay(40); } if (x == 99) { irsend.sendNEC(0xFD18E7, 32); delay(40); } if (x == 100) { irsend.sendNEC(0xFDE817, 32); delay(40); } if (x == 101) { irsend.sendNEC(0xFDA857, 32); delay(40); } if (x == 102) { irsend.sendNEC(0xFD6897, 32); delay(40); } if (x == 103) { irsend.sendNEC(0xFDA857, 32); delay(40); } if (x == 104) { irsend.sendNEC(0xFD6897, 32); delay(40); } if (x == 105) { irsend.sendNEC(0xFDE817, 32); delay(40); } if (x == 106) { irsend.sendNEC(0xFD18E7, 32); delay(40); } if (x == 107) { irsend.sendNEC(0xFD9867, 32); delay(40); } if (x == 108) { irsend.sendNEC(0xFD28D7, 32); delay(40); } if (x == 109) { irsend.sendNEC(0xFD20DF, 32); delay(40); } } Serial.println(x); Serial.println(y); } }