Allgemeinere Version fuer die Allgemeinheit

This commit is contained in:
starcalc 2017-08-12 22:23:30 +02:00
parent 77c6e7ca8b
commit 074afda3f0
1 changed files with 28 additions and 27 deletions

View File

@ -12,13 +12,13 @@
#include <OneWire.h>
#include <DallasTemperature.h>
const char* ssid = "CTDO-IoT";
const char* password = "";
const char* ssid = "ENTER_YOUR_SSID_HERE";
const char* password = "ENTER_YOUR_WLAN_PASS_HERE";
#define DEVICENAME "haus/bad"
#define DEVICENAME "maintopic/devicename"
#define TOPIC DEVICENAME"/temperature"
#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
#define VCCPIN D7
@ -85,12 +85,15 @@ void setup() {
void loop() {
// Send the command to get temperature readings
Serial.println("Requesting Temperature");
sensors.requestTemperatures();
// You can have more than one DS18B20 on the same bus.
// 0 refers to the first IC on the wire
Serial.println("Requesting Temperature from Device 0");
tempC = sensors.getTempCByIndex(0);
Serial.println("Connecting to WIFI");
// Connect to WiFi
WiFi.begin(ssid, password);
int timeout = 0;
@ -129,8 +132,6 @@ void loop() {
Serial.print(".");
}
Serial.println("");
initiateDeepSleep();
}