I have the wemos d1 board with an adafruit one wire thermocouple.
Can someone help me with modifying my sketch?
I do not understand yet the gpio setup and placements yet so that I dont mess up the booting.
The code below works and gets a hardcoded temp to my server.
Now I just need to get the onewire into the mix but after hours of reading, i dont see where people are switching the pinmode.
Thanks and any tips are greatly appreciated.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#define USE_SERIAL Serial
ESP8266WiFiMulti WiFiMulti;
void setup() {
USE_SERIAL.begin(115200);
// USE_SERIAL.setDebugOutput(true);
USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();
for(uint8_t t = 4; t > 0; t--) {
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
USE_SERIAL.flush();
delay(1000);
}
WiFiMulti.addAP("DD-WRT", "********");
}
void loop() {
// wait for WiFi connection
if((WiFiMulti.run() == WL_CONNECTED)) {
HTTPClient http;
USE_SERIAL.print("[HTTP] begin...\n");
http.begin("www.****.com", 80, "/temp/select.php?t=125"); //HTTP
USE_SERIAL.print("[HTTP] GET...\n");
// start connection and send HTTP header
int httpCode = http.GET();
if(httpCode) {
// HTTP header has been send and Server response header has been handled
USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
// file found at server
if(httpCode == 200) {
String payload = http.getString();
USE_SERIAL.println(payload);
}
} else {
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
}
}
delay(10000);
}