Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.78 KB | None | 0 0
  1.  
  2. #include <Arduino.h>
  3. #include <IRsend.h>
  4.  
  5. const uint16_t kIrLed = 2;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
  6. const uint16_t kUndoBtn = 1;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
  7. const uint16_t kResetPin = 0;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
  8.  
  9. IRsend irsend(kIrLed);  // Set the GPIO to be used to sending the message.
  10.  
  11. // Example of data captured by IRrecvDumpV2.ino
  12. uint16_t rawDataAdd[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550,
  13.                         600, 1650, 650, 550, 600, 1650, 650, 1650, 650, 1650,
  14.                         600, 550, 650, 1650, 650, 1650, 650, 550, 600, 1650,
  15.                         650, 1650, 650, 550, 650, 550, 650, 1650, 650, 550,
  16.                         650, 550, 650, 550, 600, 550, 650, 550, 650, 550,
  17.                         650, 1650, 600, 550, 650, 1650, 650, 1650, 650, 1650,
  18.                         650, 1650, 650, 1650, 650, 1650, 600};
  19.  
  20. uint16_t rawDataUndo[67] = {9000, 4500, 850, 550, 850, 1850, 600, 550, 850, 550,
  21.                         600, 1850, 850, 550, 600, 1850, 850, 1850, 850, 1850,
  22.                         600, 550, 850, 1850, 850, 1850, 850, 550, 600, 1850,
  23.                         850, 1850, 850, 550, 850, 550, 850, 1850, 850, 550,
  24.                         850, 550, 850, 550, 600, 550, 850, 550, 850, 550,
  25.                         850, 1850, 600, 550, 850, 1850, 850, 1850, 850, 1850,
  26.                         850, 1850, 850, 1850, 850, 1850, 600};
  27.  
  28. void setup() {
  29.   pinMode(kIrLed,OUTPUT);
  30.   pinMode(kUndoBtn,INPUT);
  31.   pinMode(kResetPin,OUTPUT);
  32.   digitalWrite(kResetPin,HIGH);
  33.  
  34.   irsend.begin();
  35.  
  36. }
  37.  
  38. void loop() {
  39.   bool isUndo = digitalRead(kUndoBtn);
  40.  
  41.   irsend.sendRaw(isUndo?rawDataUndo:rawDataAdd, 67, 38);
  42.  
  43.   delay(100);
  44.   digitalWrite(kResetPin,LOW);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement