first test transmitting IR
This commit is contained in:
36
things/DeviceIrTx.h
Normal file
36
things/DeviceIrTx.h
Normal file
@ -0,0 +1,36 @@
|
||||
#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
|
Reference in New Issue
Block a user