Updated Code to fit the correct Pins

This commit is contained in:
Simeon "Waldo" Wallrath 2024-05-05 12:36:02 +02:00
parent 1eeb2969dc
commit 2106c526b6

View file

@ -34,13 +34,13 @@ Point sensor("SampleData");
#define VREF 3.3 // analog reference voltage(Volt) of the ADC #define VREF 3.3 // analog reference voltage(Volt) of the ADC
//Relay //Relay
#define HeatPin 27 #define HeatPin 14
#define StirrerPin 26 #define StirrerPin 13
#define LightPin 25 #define LightPin 12
//Water Level I2C //Water Level I2C
#define I2C_SDA_PIN 13 #define I2C_SDA_PIN 27
#define I2C_SCL_PIN 14 #define I2C_SCL_PIN 25
unsigned char low_data[8] = {0}; unsigned char low_data[8] = {0};
unsigned char high_data[12] = {0}; unsigned char high_data[12] = {0};
#define NO_TOUCH 0xFE #define NO_TOUCH 0xFE
@ -64,7 +64,7 @@ OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire); DallasTemperature sensors(&oneWire);
//Trigger for Reset //Trigger for Reset
#define RESET_TRIGGER 12 #define RESET_TRIGGER 26
int buttonState = 0; int buttonState = 0;
int lastButtonState = 0; int lastButtonState = 0;
int startPressed = 0; int startPressed = 0;
@ -79,7 +79,7 @@ int previousMinute = -1;
unsigned long previousMillisSync = 0; unsigned long previousMillisSync = 0;
unsigned long previousMillisPrint = 0; unsigned long previousMillisPrint = 0;
const unsigned long intervalSync = 1800000; const unsigned long intervalSync = 1800000;
const unsigned long intervalPrint = 60000; const unsigned long intervalPrint = 600000;
// Box für Zieltemperatur // Box für Zieltemperatur
WiFiManagerParameter MaxTemp_Text_Box("MaxTemp_Text", "Maximale Temperatur", "32", 2); WiFiManagerParameter MaxTemp_Text_Box("MaxTemp_Text", "Maximale Temperatur", "32", 2);
@ -176,23 +176,36 @@ void setup()
} }
if (pref.getBool("setupbool") == false) if (pref.getBool("setupbool") == false)
{ pref.putString("ReaktornameUser", Token_Text_Box.getValue());
pref.putString("ReaktornameUser", Token_Text_Box.getValue());
pref.putBool("setupbool", true); pref.putBool("setupbool", true);
blinkLEDs(10,20); blinkLEDs(10,20);
String ReaktornameUser = pref.getString("ReaktornameUser");
const char* Reaktorname = ReaktornameUser.c_str();
Serial.print("Your Reactor is called: ");
Serial.println(Reaktorname);
sensor.addTag("Reaktorname", Reaktorname);
Serial.print("Added Tag");
//Write one initial Point for initial User Feedback
AddSensorData();
WriteSensorData(); {
}
else
{
String ReaktornameUser = pref.getString("ReaktornameUser");
const char* Reaktorname = ReaktornameUser.c_str();
Serial.print("Your Reactor is called: ");
Serial.println(Reaktorname);
sensor.addTag("Reaktorname", Reaktorname);
Serial.print("Added Tag");
} }
} }
String ReaktornameUser = pref.getString("ReaktornameUser");
const char* Reaktorname = ReaktornameUser.c_str();
Serial.print("Your Reactor is called: ");
Serial.println(Reaktorname);
sensor.addTag("Reaktorname", Reaktorname);
//Write one initial Point for initial User Feedback
AddSensorData();
WriteSensorData();
} }
@ -228,7 +241,7 @@ void loop()
if (((currentHour == 0 && currentMinute == 0) || if (((currentHour == 0 && currentMinute == 0) ||
(currentHour == 6 && currentMinute == 0) || (currentHour == 6 && currentMinute == 0) ||
(currentHour == 14 && currentMinute == 15) || (currentHour == 12 && currentMinute == 0) ||
(currentHour == 18 && currentMinute == 0)) && (currentHour == 18 && currentMinute == 0)) &&
(!dataSent)) (!dataSent))
{ {
@ -307,6 +320,7 @@ float readKonzentration()
int readWaterlevel() int readWaterlevel()
{ {
//uses i2c
int sensorvalue_min = 250; int sensorvalue_min = 250;
int sensorvalue_max = 255; int sensorvalue_max = 255;
int low_count = 0; int low_count = 0;
@ -588,7 +602,8 @@ void PrintValues()
float PrintintervalMinutes = atof(pref.getString("IntervalStirrer").c_str()); float PrintintervalMinutes = atof(pref.getString("IntervalStirrer").c_str());
float PrintdurationMinutes = atof(pref.getString("DurationStirrer").c_str()); float PrintdurationMinutes = atof(pref.getString("DurationStirrer").c_str());
String ReaktornameUser = pref.getString("ReaktornameUser"); String ReaktornameUser = pref.getString("ReaktornameUser");
Serial.println("");
Serial.println("___BEGIN___");
Serial.println("Your Reactor is called: " + ReaktornameUser); Serial.println("Your Reactor is called: " + ReaktornameUser);
Serial.print(F("Europe: ")); Serial.print(F("Europe: "));
Serial.println(myTZ.dateTime()); Serial.println(myTZ.dateTime());
@ -604,6 +619,7 @@ void PrintValues()
Serial.println("MaxTemp: " + String(PrintMaximumTemp)); Serial.println("MaxTemp: " + String(PrintMaximumTemp));
Serial.println("Licht an um " + String(PrintlightOnTime)); Serial.println("Licht an um " + String(PrintlightOnTime));
Serial.println("Licht aus um " + String(PrintlightOffTime)); Serial.println("Licht aus um " + String(PrintlightOffTime));
Serial.println("___END___");
} }
} }