Advertisement
Golden_Rus

Arduino

Dec 18th, 2015
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.75 KB | None | 0 0
  1. #include <IRremote.h>
  2.  
  3. IRsend irsend;
  4. int cmd;
  5. void setup() {
  6.   Serial.begin(9600);
  7.   Serial.setTimeout(20);
  8. }
  9.  
  10. void loop() {
  11.   cmd =-1;
  12.   if(Serial.available())
  13.   {
  14.     cmd = Serial.parseInt();
  15.   switch (cmd) {
  16.      case 0:psd();
  17.      break;
  18.      case 1:avol();
  19.      break;
  20.      case 2:mvol();
  21.      break;
  22.      case 3:pwr();
  23.      break;
  24.      case 4:ach();
  25.      break;
  26.      case 5:mch();
  27.      break;
  28.      case 6:_1();
  29.      break;
  30.      case 7:_2();
  31.      break;
  32.      case 8:_3();
  33.      break;
  34.      case 9:_4();
  35.      break;
  36.      case 10:_5();
  37.      break;
  38.      case 11:_6();
  39.      break;
  40.      case 12:_7();
  41.      break;
  42.      case 13:_8();
  43.      break;
  44.      case 14:_9();
  45.      break;
  46.      case 15:_0();
  47.      break;
  48.      case 16:ext();
  49.      break;
  50.      case 17:menu();
  51.      break;
  52.      case 18:green();
  53.      break;
  54.      case 19:list();
  55.      break;
  56.   }
  57.   Serial.println(cmd);
  58.   }
  59. }
  60.  
  61. void psd()
  62. {
  63.   irsend.sendNEC(0xFFFFFFFF, 32);
  64. }
  65.  
  66. void avol()
  67. {
  68.   irsend.sendNEC(0x828D7, 32);
  69. }
  70. void mvol()
  71. {
  72.   irsend.sendNEC(0x848B7, 32);
  73. }
  74. void pwr()
  75. {
  76.   irsend.sendNEC(0x800FF, 32);
  77. }
  78. void ach()
  79. {
  80.   irsend.sendNEC(0x88877, 32);
  81. }
  82. void mch()
  83. {
  84.   irsend.sendNEC(0x8A857, 32);
  85. }
  86. void _1()
  87. {
  88.   irsend.sendNEC(0x8C03F, 32);
  89. }
  90. void _2()
  91. {
  92.   irsend.sendNEC(0x820DF, 32);
  93. }
  94. void _3()
  95. {
  96.   irsend.sendNEC(0x8A05F, 32);
  97. }
  98. void _4()
  99. {
  100.   irsend.sendNEC(0x8609F, 32);
  101. }
  102. void _5()
  103. {
  104.   irsend.sendNEC(0x8E01F, 32);
  105. }
  106. void _6()
  107. {
  108.   irsend.sendNEC(0x810EF, 32);
  109. }
  110. void _7()
  111. {
  112.   irsend.sendNEC(0x8906F, 32);
  113. }
  114. void _8()
  115. {
  116.   irsend.sendNEC(0x850AF, 32);
  117. }
  118. void _9()
  119. {
  120.   irsend.sendNEC(0x8D02F, 32);
  121. }
  122. void _0()
  123. {
  124.   irsend.sendNEC(0x830CF, 32);
  125. }
  126. void ext()
  127. {
  128.   irsend.sendNEC(0x86897, 32);
  129. }
  130. void menu()
  131. {
  132.   irsend.sendNEC(0x8708F, 32);
  133. }
  134. void green()
  135. {
  136.   irsend.sendNEC(0x8B847, 32);
  137. }
  138. void list()
  139. {
  140.   irsend.sendNEC(0x8D827, 32);
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement