mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
class
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
#include "Global.h"
|
||||
|
||||
class Item {
|
||||
private:
|
||||
|
||||
protected:
|
||||
String type;
|
||||
String key;
|
||||
String file;
|
||||
|
||||
34
include/Class/button.h
Normal file
34
include/Class/button.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Class/Item.h"
|
||||
#include "Global.h"
|
||||
|
||||
class Button : public Item {
|
||||
public:
|
||||
|
||||
void pinModeSet(int pinf) {
|
||||
if (pin != "") {
|
||||
pinMode(pinf, OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
void pinStateSet(int pinf, int statef) {
|
||||
if (state != "") {
|
||||
digitalWrite(pinf, statef);
|
||||
jsonWriteInt(configLiveJson, key, statef);
|
||||
MqttClient::publishStatus(key, String(statef));
|
||||
}
|
||||
}
|
||||
|
||||
void pinStateSetInv(int pinf, int statef) {
|
||||
if (inv != "" && state != "") {
|
||||
digitalWrite(pinf, !statef);
|
||||
jsonWriteInt(configLiveJson, key, !statef);
|
||||
MqttClient::publishStatus(key, String(!statef));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
extern Button* myButton;
|
||||
Reference in New Issue
Block a user