This commit is contained in:
Marcus 2023-08-07 00:44:15 +02:00
parent ea27ac3c7b
commit 02583b9497

View file

@ -52,13 +52,13 @@ int cTemp = 5;
void setup() {
// put your setup code here, to run once:
pinMode(MOSFET1, OUTPUT);
pinMode(MOSFET2, OUTPUT);
Serial.begin(9600);
sensors.begin();
// locate devices on the bus
// locate devices on the bus
Serial.println("Locating devices...");
Serial.print("Found ");
deviceCount = sensors.getDeviceCount();
@ -77,6 +77,16 @@ void setup() {
}
Serial.println("");
Serial.print("MOSFET1 start temp: ");
Serial.print(HTemp1);
Serial.print("°C, stop temp: ");
Serial.print(LTemp1);
Serial.println("°C");
Serial.print("MOSFET2 start temp: ");
Serial.print(HTemp2);
Serial.print("°C, stop temp: ");
Serial.print(LTemp2);
Serial.println("°C");
}
void loop() {
@ -106,7 +116,7 @@ void loop() {
}
/*
Serial.print("Sens 1 ");
Serial.print("Celsius temperature: ");
// Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
@ -124,7 +134,18 @@ void loop() {
Serial.print(sensors.getTempF(addrSensor2));
Serial.print(" - MOSFET2 Sate: ");
Serial.println(fetState2);
*/
StaticJsonDocument<96> jsonOut;
//jsonOut["sensor"] = "1";
jsonOut["sensor1"]["temp"] = tempSensor1;
jsonOut["sensor1"]["state"] = fetState1;
//jsonOut["sensor"] = "2";
jsonOut["sensor2"]["temp"] = tempSensor2;
jsonOut["sensor2"]["state"] = fetState2;
serializeJson(jsonOut, Serial);
Serial.println();
/*
digitalWrite(MOSFET, HIGH);
delay(2000);