mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
some changes
This commit is contained in:
26
include/Class/Sensor.h
Normal file
26
include/Class/Sensor.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
|
||||
class Sensor : public LineParsing {
|
||||
public:
|
||||
Sensor() : LineParsing(){};
|
||||
|
||||
void SensorInit() {
|
||||
if (_pin != "") {
|
||||
pinMode(_pin.toInt(), INPUT);
|
||||
}
|
||||
}
|
||||
|
||||
void SensorRead(String key, String pin, String state) {
|
||||
int pinInt = pin.toInt();
|
||||
analogWrite(pinInt, state.toInt());
|
||||
eventGen(key, "");
|
||||
jsonWriteInt(configLiveJson, key, state.toInt());
|
||||
MqttClient::publishStatus(key, state);
|
||||
}
|
||||
};
|
||||
|
||||
//extern Sensor* mySensor;
|
||||
Reference in New Issue
Block a user