21 lines
357 B
C++
21 lines
357 B
C++
#pragma once
|
|
|
|
#include <TinySensor.h>
|
|
#include <RCSwitch.h>
|
|
|
|
class ContactSensor: public TinySensor {
|
|
|
|
public:
|
|
ContactSensor(short id, short senderPin) :
|
|
TinySensor(id, senderPin) {
|
|
}
|
|
|
|
void sendStateAndVoltage(bool state) {
|
|
unsigned long value = 0x70000000;
|
|
value |= readVcc() << 6;
|
|
value |= !state << 5;
|
|
value |= id;
|
|
sendInfo(value);
|
|
}
|
|
};
|