Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <IRsend.h>
- const uint16_t kIrLed = 2; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
- const uint16_t kUndoBtn = 1; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
- const uint16_t kResetPin = 0; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
- IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
- // Example of data captured by IRrecvDumpV2.ino
- uint16_t rawDataAdd[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550,
- 600, 1650, 650, 550, 600, 1650, 650, 1650, 650, 1650,
- 600, 550, 650, 1650, 650, 1650, 650, 550, 600, 1650,
- 650, 1650, 650, 550, 650, 550, 650, 1650, 650, 550,
- 650, 550, 650, 550, 600, 550, 650, 550, 650, 550,
- 650, 1650, 600, 550, 650, 1650, 650, 1650, 650, 1650,
- 650, 1650, 650, 1650, 650, 1650, 600};
- uint16_t rawDataUndo[67] = {9000, 4500, 850, 550, 850, 1850, 600, 550, 850, 550,
- 600, 1850, 850, 550, 600, 1850, 850, 1850, 850, 1850,
- 600, 550, 850, 1850, 850, 1850, 850, 550, 600, 1850,
- 850, 1850, 850, 550, 850, 550, 850, 1850, 850, 550,
- 850, 550, 850, 550, 600, 550, 850, 550, 850, 550,
- 850, 1850, 600, 550, 850, 1850, 850, 1850, 850, 1850,
- 850, 1850, 850, 1850, 850, 1850, 600};
- void setup() {
- pinMode(kIrLed,OUTPUT);
- pinMode(kUndoBtn,INPUT);
- pinMode(kResetPin,OUTPUT);
- digitalWrite(kResetPin,HIGH);
- irsend.begin();
- }
- void loop() {
- bool isUndo = digitalRead(kUndoBtn);
- irsend.sendRaw(isUndo?rawDataUndo:rawDataAdd, 67, 38);
- delay(100);
- digitalWrite(kResetPin,LOW);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement