This commit is contained in:
Nicu Hodos 2022-10-26 09:52:37 +02:00
parent c053cc9310
commit f9bcdecb57
3 changed files with 8 additions and 13 deletions

View File

@ -1,5 +1,6 @@
#if DHT_SENSOR #if DHT_SENSOR
#include <Adafruit_Sensor.h>
#include <DHT.h> #include <DHT.h>
#define DHT11_PIN 12 #define DHT11_PIN 12

View File

@ -3,7 +3,7 @@
#include <RCSwitch.h> #include <RCSwitch.h>
class Protocol { class Protocol {
private:
unsigned int protocol; unsigned int protocol;
public: public:

View File

@ -1,8 +1,5 @@
#include <Arduino.h> #include <Arduino.h>
#include <RCSwitch.h> #include <RCSwitch.h>
#include <Adafruit_Sensor.h>
#include "Tiny.h"
#include <ArduinoJson.h>
#include "Dht.h" #include "Dht.h"
#include "Protocol_1.h" #include "Protocol_1.h"
#include "Protocol_2.h" #include "Protocol_2.h"
@ -14,9 +11,6 @@
RCSwitch mySwitch = RCSwitch(); RCSwitch mySwitch = RCSwitch();
void readRcSwitch();
void readCommand();
void setup() { void setup() {
digitalWrite(RESET_PIN, HIGH); digitalWrite(RESET_PIN, HIGH);
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
@ -33,12 +27,6 @@ void setup() {
delay(1000); delay(1000);
} }
void loop() {
readCommand();
readRcSwitch();
Dht::read();
}
Protocol findProtocol(unsigned int protocol) { Protocol findProtocol(unsigned int protocol) {
switch (mySwitch.getReceivedProtocol()) { switch (mySwitch.getReceivedProtocol()) {
case 1: case 1:
@ -107,3 +95,9 @@ void readCommand() {
runJsonCommands(cmd.c_str()); runJsonCommands(cmd.c_str());
} }
} }
void loop() {
readCommand();
readRcSwitch();
Dht::read();
}