22 lines
440 B
C++
22 lines
440 B
C++
#pragma once
|
|
|
|
#include <TinySensor.h>
|
|
#include <RCSwitch.h>
|
|
|
|
class ContactSensor: public TinySensor {
|
|
SensorType sensorType = CONTACT;
|
|
|
|
public:
|
|
ContactSensor(short id, short senderPin) :
|
|
TinySensor(id, senderPin) {
|
|
}
|
|
|
|
void sendStateAndVoltage(bool state) {
|
|
sendInfo(ID(id) | VCC(readVcc()) | STATE(!state) | TYPE(sensorType));
|
|
}
|
|
|
|
void sendState(bool state) {
|
|
sendInfo(ID(id) | VCC(0) | STATE(!state) | TYPE(sensorType));
|
|
}
|
|
};
|