37 lines
696 B
C
37 lines
696 B
C
|
#ifndef DEVICEIRTX_H
|
||
|
#define DEVICEIRTX_H
|
||
|
|
||
|
#include "Device.h"
|
||
|
#include <Homie.h>
|
||
|
#include <IRremoteESP8266.h>
|
||
|
|
||
|
class DeviceIrTx : public Device {
|
||
|
public:
|
||
|
inline DeviceIrTx(byte irtxPin):irsend(irtxPin) {
|
||
|
pin_irtx = irtxPin;
|
||
|
}
|
||
|
virtual void deviceSetup();
|
||
|
virtual void deviceRegister();
|
||
|
virtual void deviceLoop();
|
||
|
private:
|
||
|
byte pin_irtx;
|
||
|
IRsend irsend;
|
||
|
decode_results results;
|
||
|
HomieNode irTxNode = HomieNode("irtx", "irtx");
|
||
|
};
|
||
|
|
||
|
void DeviceIrTx::deviceSetup() {
|
||
|
pinMode(pin_irtx, OUTPUT);
|
||
|
}
|
||
|
|
||
|
void DeviceIrTx::deviceRegister() {
|
||
|
Homie.registerNode(irTxNode);
|
||
|
}
|
||
|
|
||
|
void DeviceIrTx::deviceLoop() {
|
||
|
irsend.sendSony(0xa90, 12);
|
||
|
delay(500);
|
||
|
}
|
||
|
|
||
|
#endif
|