added new device type IrRx (infrared receiver)
This commit is contained in:
36
things/DeviceIrRx.h
Normal file
36
things/DeviceIrRx.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef DEVICEIRRX_H
|
||||
#define DEVICEIRRX_H
|
||||
|
||||
#include "Device.h"
|
||||
#include <Homie.h>
|
||||
|
||||
class DeviceIrRx : public Device {
|
||||
public:
|
||||
inline DeviceIrRx(byte irrxPin, byte powerPin) {
|
||||
pin_irrx = irrxPin;
|
||||
pin_power = powerPin;
|
||||
}
|
||||
virtual void deviceSetup();
|
||||
virtual void deviceRegister();
|
||||
virtual void deviceLoop();
|
||||
private:
|
||||
byte pin_irrx;
|
||||
byte pin_power;
|
||||
HomieNode irRxNode = HomieNode("irrx", "irrx");
|
||||
};
|
||||
|
||||
void DeviceIrRx::deviceSetup() {
|
||||
pinMode(pin_irrx, INPUT);
|
||||
pinMode(pin_power, OUTPUT);
|
||||
digitalWrite(pin_power, HIGH);
|
||||
}
|
||||
|
||||
void DeviceIrRx::deviceRegister() {
|
||||
Homie.registerNode(irRxNode);
|
||||
}
|
||||
|
||||
void DeviceIrRx::deviceLoop() {
|
||||
// TODO receive IR
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user