Open ChipStewart1 opened 6 years ago
hey, i had the same issue. the wemos seemed to not flash new software and stuck somewhere. i fixed it by changing the build options once (i changed the flash size and the IwIP Variant) to force a completely new build. now its working as usual.
Having just moved, I stumbled across a Wemos D1 with a DHT11, and upon which I had flashed esp8266-dht-thingspeak-logger a year or two ago. I fired it up last night and it logged data until early this morning.
Now, for no apparent reason, it has stopped working, even though I can post the same url through a browser. Reflashing didn't seem to help. The serial monitor shows:
.... WiFi connected IP address: 192.168.0.168 connecting to api.thingspeak.com connection failed connecting to api.thingspeak.com connection failed connecting to api.thingspeak.com connection failed connecting to api.thingspeak.com connection failed [which runs indefinitely]
I'll post the code below, but it is pretty much stock. I tried changing my api write key, but it didn't make any difference. Any ideas?
/**The MIT License (MIT)
Copyright (c) 2015 by Daniel Eichhorn
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See more at http://blog.squix.ch */
include
include "DHT.h"
/***
const char ssid = "[SSID]"; const char password = "[password]";
const char* host = "api.thingspeak.com";
const char* THINGSPEAK_API_KEY = "[API Write Key]";
// DHT Settings
define DHTPIN D4 // what digital pin we're connected to. If you are not using NodeMCU change D6 to real pin
// Uncomment whatever type you're using!
define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 //#define DHTTYPE DHT21 // DHT 21 (AM2301)
const boolean IS_METRIC = true;
// Update every 600 seconds = 10 minutes. Min with Thingspeak is ~20 seconds const int UPDATE_INTERVAL_SECONDS = 300;
/***
// Initialize the temperature/ humidity sensor DHT dht(DHTPIN, DHTTYPE);
void setup() { Serial.begin(115200); delay(10);
// We start by connecting to a WiFi network
Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println(""); Serial.println("WiFi connected");
Serial.println("IP address: "); Serial.println(WiFi.localIP()); }
void loop() {
Serial.print("connecting to "); Serial.println(host);
// Go back to sleep. If your sensor is battery powered you might // want to use deep sleep here delay(1000 * UPDATE_INTERVAL_SECONDS); }