Guest User

Untitled

a guest
Apr 21st, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <IRremote.h>
  2. int tempo;
  3. int fita1 = 13;
  4. int fita2 = 10;
  5. int fita3 = 7;
  6. int fita4 = 4;
  7.  
  8. int RECV_PIN = 22;
  9.  
  10. IRrecv irrecv(RECV_PIN);
  11. decode_results results;
  12.  
  13. void setup(){
  14.   Serial.begin(9600);
  15.   irrecv.enableIRIn(); // Start the receiver
  16.  
  17.   pinMode(fita1, OUTPUT);
  18.   pinMode(fita2, OUTPUT);
  19.   pinMode(fita3, OUTPUT);
  20.   pinMode(fita4, OUTPUT);
  21. }
  22.  
  23. void loop() {
  24.   if (irrecv.decode(&results)) {
  25.     Serial.println(results.value, HEX);
  26.     irrecv.resume(); // Receive the next value
  27.   }
  28.  
  29.   tempo = 50;
  30.  
  31.   if (results.value == 0xE0E020DF) { //Botao 1 do controle pressionado.
  32.     digitalWrite(fita1, HIGH);       //Executa atΓ© que se aperte outro botao.
  33.     delay (tempo);
  34.     digitalWrite(fita1, LOW);
  35.     delay (tempo);
  36.   }
  37.  
  38.   if (results.value == 0xE0E0A05F) { //Botao 2 do controle pressionado
  39.     digitalWrite(fita2, HIGH);       //Executa atΓ© que se aperte outro botao.
  40.     delay (tempo);
  41.     digitalWrite(fita2, LOW);
  42.     delay (tempo);
  43.   }
  44.  
  45. } //Fim do void loop.
Add Comment
Please, Sign In to add comment