Merge branch 'wemos-build' of gitlab.simonzeyer.de:2222]:dezeyer23/truhensteuerung into wemos-build
This commit is contained in:
commit
0301212bb5
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.autogit
|
||||
*.txt
|
||||
*.pdf
|
||||
*.pdf
|
||||
output/
|
7
.vscode/arduino.json
vendored
Normal file
7
.vscode/arduino.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"board": "esp8266:esp8266:d1_mini",
|
||||
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600",
|
||||
"port": "COM4",
|
||||
"sketch": "Steuerung_Truhen.ino",
|
||||
"output": "output"
|
||||
}
|
17
.vscode/c_cpp_properties.json
vendored
Normal file
17
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"C:\\Users\\User\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**",
|
||||
"C:\\Users\\User\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.6.0\\**"
|
||||
],
|
||||
"forcedInclude": [],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu11",
|
||||
"cppStandard": "gnu++14"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"window.zoomLevel": 0,
|
||||
"arduino.path": "C:\\Program Files (x86)\\Arduino",
|
||||
"git.autofetch": true,
|
||||
"C_Cpp.updateChannel": "Insiders",
|
||||
"arduino.additionalUrls": ""
|
||||
}
|
26
Settings.h
Normal file
26
Settings.h
Normal file
@ -0,0 +1,26 @@
|
||||
//* **EINSTELLUNGEN** *//
|
||||
#define SETUPTIMEOUT 500
|
||||
|
||||
// So, the minimum sampling period is the minimum time
|
||||
// interval that we need to wait between two consecutive
|
||||
// measurements from the sensor. In the case of the DHT22,
|
||||
// this value is of 2 seconds [1].
|
||||
|
||||
static const unsigned long MESS_REFRESH_INTERVAL = 10000; // ms getMinimumSamplingPeriod == 2 sec
|
||||
static const unsigned long SCHALT_REFRESH_INTERVAL = 60000; // ms
|
||||
static const unsigned long LCD_REFRESH_INTERVAL = 500; // ms
|
||||
|
||||
const int uT = 1; //Abschalt-Temperatur in °C
|
||||
const int oT = 4; //Einschalt-Temperatur in °C
|
||||
|
||||
/*
|
||||
Truhe truhen[] = {
|
||||
Truhe("Truhe 1", 2, 8),
|
||||
Truhe("Truhe 2", 3, 9),
|
||||
};*/
|
||||
//Name, Relaypin, DTH Pin
|
||||
Truhe truhen[] = {
|
||||
Truhe("Truhe 1", D0, D2),
|
||||
};
|
||||
|
||||
//LiquidCrystal_I2C lcd(0x3F, 0, 0, 0, 0, 0, 0, 0, 0, POSITIVE); //0x3F = Adresse des Displays
|
26
Settings.h.original
Normal file
26
Settings.h.original
Normal file
@ -0,0 +1,26 @@
|
||||
//* **EINSTELLUNGEN** *//
|
||||
#define SETUPTIMEOUT 500
|
||||
|
||||
// So, the minimum sampling period is the minimum time
|
||||
// interval that we need to wait between two consecutive
|
||||
// measurements from the sensor. In the case of the DHT22,
|
||||
// this value is of 2 seconds [1].
|
||||
|
||||
static const unsigned long MESS_REFRESH_INTERVAL = 10000; // ms getMinimumSamplingPeriod == 2 sec
|
||||
static const unsigned long SCHALT_REFRESH_INTERVAL = 60000; // ms
|
||||
static const unsigned long LCD_REFRESH_INTERVAL = 500; // ms
|
||||
|
||||
const int uT = 1; //Abschalt-Temperatur in °C
|
||||
const int oT = 4; //Einschalt-Temperatur in °C
|
||||
|
||||
/*
|
||||
Truhe truhen[] = {
|
||||
Truhe("Truhe 1", 2, 8),
|
||||
Truhe("Truhe 2", 3, 9),
|
||||
};*/
|
||||
//Name, Relaypin, DTH Pin
|
||||
Truhe truhen[] = {
|
||||
Truhe("Truhe 1", D0, D2),
|
||||
};
|
||||
|
||||
//LiquidCrystal_I2C lcd(0x3F, 0, 0, 0, 0, 0, 0, 0, 0, POSITIVE); //0x3F = Adresse des Displays
|
46
Truhe.cpp
Normal file
46
Truhe.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include "Truhe.h"
|
||||
Truhe::Truhe(String name, int relay, uint8_t dhtpin): _dht(dhtpin, DHT22) {
|
||||
_name = name;
|
||||
_relay = relay;
|
||||
_dhtpin = dhtpin;
|
||||
|
||||
};
|
||||
|
||||
void Truhe::setup() {
|
||||
Serial.println("Setup " + _name);
|
||||
Serial.println(_dhtpin);
|
||||
pinMode(_relay, OUTPUT);
|
||||
digitalWrite(_relay, HIGH);
|
||||
pinMode(_dhtpin, INPUT);
|
||||
_dht.begin();
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void Truhe::mess() {
|
||||
Serial.println(String(_name) + " mess()");
|
||||
//Serial.print("Minimum Sampling Period: ");
|
||||
//delay(_dht.getMinimumSamplingPeriod());
|
||||
_cur_temp = _dht.readTemperature();
|
||||
Serial.println(String(_name) + "\t\t" + String((int)_cur_temp) + " grad gelesen");
|
||||
};
|
||||
|
||||
void Truhe::schalt(int oT, int uT) {
|
||||
Serial.print(String(_name) + " schalt() stat: " + String(_stat));
|
||||
if (_cur_temp >= oT && _stat != 1) {
|
||||
digitalWrite(_relay, LOW);
|
||||
_stat = 1;
|
||||
Serial.println("schalt " + _name + " zu " + String(_stat));
|
||||
}
|
||||
else if (_cur_temp <= uT && _stat != 0) {
|
||||
digitalWrite(_relay, HIGH);
|
||||
_stat = 0;
|
||||
Serial.println("schalt " + _name + " zu " + String(_stat));
|
||||
}
|
||||
}
|
||||
int Truhe::getUpdLcd(){ return _updlcd;};
|
||||
void Truhe::setUpdLcd(int updlcd){ _updlcd = updlcd;};
|
||||
int Truhe::getRelay(){ return _relay;};
|
||||
int Truhe::getDhtPin(){return _dhtpin;};
|
||||
int Truhe::getStat(){return _stat;};
|
||||
float Truhe::getCurTemp(){return _cur_temp;};
|
||||
String Truhe::getName(){return _name;};
|
23
Truhe.h
Normal file
23
Truhe.h
Normal file
@ -0,0 +1,23 @@
|
||||
#include <DHT.h>
|
||||
class Truhe {
|
||||
private:
|
||||
DHT _dht;
|
||||
int _relay;
|
||||
uint8_t _dhtpin;
|
||||
int _stat = -1;
|
||||
float _cur_temp = 0;
|
||||
int _updlcd = 0;
|
||||
String _name = "";
|
||||
public:
|
||||
Truhe(String, int, uint8_t);
|
||||
void setup();
|
||||
void mess();
|
||||
void schalt(int, int);
|
||||
int getUpdLcd();
|
||||
void setUpdLcd(int);
|
||||
int getRelay();
|
||||
int getDhtPin();
|
||||
int getStat();
|
||||
float getCurTemp();
|
||||
String getName();
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user