Allgemeinere Version fuer die Allgemeinheit
This commit is contained in:
parent
77c6e7ca8b
commit
074afda3f0
|
@ -12,13 +12,13 @@
|
||||||
#include <OneWire.h>
|
#include <OneWire.h>
|
||||||
#include <DallasTemperature.h>
|
#include <DallasTemperature.h>
|
||||||
|
|
||||||
const char* ssid = "CTDO-IoT";
|
const char* ssid = "ENTER_YOUR_SSID_HERE";
|
||||||
const char* password = "";
|
const char* password = "ENTER_YOUR_WLAN_PASS_HERE";
|
||||||
|
|
||||||
#define DEVICENAME "haus/bad"
|
#define DEVICENAME "maintopic/devicename"
|
||||||
#define TOPIC DEVICENAME"/temperature"
|
#define TOPIC DEVICENAME"/temperature"
|
||||||
#define ONLINETOPIC DEVICENAME"/online"
|
#define ONLINETOPIC DEVICENAME"/online"
|
||||||
#define MQTTSERVER IPAddress(195, 160, 169, 11) // raum.ctdo.de: 195.160.169.11
|
#define MQTTSERVER IPAddress(37, 187, 106, 16) // test.mosquitto.org = 37.187.106.16
|
||||||
const int sleepTimeS = 300; // Reduce this value for debugging. Increase if you want more battery life
|
const int sleepTimeS = 300; // Reduce this value for debugging. Increase if you want more battery life
|
||||||
|
|
||||||
#define VCCPIN D7
|
#define VCCPIN D7
|
||||||
|
@ -85,12 +85,15 @@ void setup() {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// Send the command to get temperature readings
|
// Send the command to get temperature readings
|
||||||
|
Serial.println("Requesting Temperature");
|
||||||
sensors.requestTemperatures();
|
sensors.requestTemperatures();
|
||||||
|
|
||||||
// You can have more than one DS18B20 on the same bus.
|
// You can have more than one DS18B20 on the same bus.
|
||||||
// 0 refers to the first IC on the wire
|
// 0 refers to the first IC on the wire
|
||||||
|
Serial.println("Requesting Temperature from Device 0");
|
||||||
tempC = sensors.getTempCByIndex(0);
|
tempC = sensors.getTempCByIndex(0);
|
||||||
|
|
||||||
|
Serial.println("Connecting to WIFI");
|
||||||
// Connect to WiFi
|
// Connect to WiFi
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
|
@ -129,8 +132,6 @@ void loop() {
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
}
|
}
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
|
|
||||||
initiateDeepSleep();
|
initiateDeepSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue