Closed tsavasci closed 5 years ago
Great! simple and amazing! Thanks for share!
I hope there is a way to upload data to ThingSpeak and Wunderground both. I didn't find a solution at the moment.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, I just added the Blynk to WeatherStationDemoExtendedDST.ino code.. nothing more.
Include this library, define Blynk print and Blynk Timer instead of ticker
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial
BlynkTimer timer;
Include your auth token for Blynk
char auth[] = "xxxxxxxxxxxxx";
Add virtual pin defs before void.setup
BLYNK_WRITE(V0) // writes current weather temp to blynk app V0 pin
{
float pinValue = param.asFloat();
}
BLYNK_WRITE(V2) // writes current weather text to blynk app V2 pin
{
String pinValue = param.asString();
}
BLYNK_WRITE(V3) // writes wifi quality to blynk app V3 pin
{
int pinValue = param.asInt();
}
In void.Setup section add Blynk config and connect. (I use local server so i declare my server ip and port, if you dont delete ip address and port.
//Blynk.config(auth); // for Blynk server
Blynk.config(auth, IPAddress(192, xxx, xxx, xxx), 8080); //for local server
Blynk.connect();
I use blynk timer
//ticker.attach(UPDATE_INTERVAL_SECS, setReadyForWeatherUpdate);
//ticker.attach(60, setReadyForDHTUpdate);
timer.setInterval(200000L, setReadyForWeatherUpdate);
timer.setInterval(130000L, setReadyForDHTUpdate);
In void loop section add this lines
if (remainingTimeBudget > 0)
{
Blynk.run();
timer.run();
}
7.Add this two bold lines in void drawCurrentWeather function
void drawCurrentWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
display->setFont(ArialMT_Plain_10);
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->drawString(60 + x, 5 + y, wunderground.getWeatherText());
Blynk.virtualWrite(V2, wunderground.getWeatherText());display->setFont(ArialMT_Plain_24);
String temp = wunderground.getCurrentTemp() + (IS_METRIC ? "°C" : "°F");
Blynk.virtualWrite(V0, wunderground.getCurrentTemp());display->drawString(60 + x, 15 + y, temp);
int tempWidth = display->getStringWidth(temp);
display->setFont(Meteocons_Plain_42);
String weatherIcon = wunderground.getTodayIcon();
int weatherIconWidth = display->getStringWidth(weatherIcon);
display->drawString(32 + x - weatherIconWidth / 2, 05 + y, weatherIcon);
}
void setReadyForDHTUpdate() {
Serial.println("Setting readyForDHTUpdate to true");
readyForDHTUpdate = true;
Blynk.virtualWrite(V3, WiFi.RSSI());}
and result...
Condition icon changes by the weather text. In my project I set them for Turkish you can change them to your language in Blynk eventor
Here is the Blynk QR of my project. You can clone it easily with Blynk app
OLED and Nodemcu works very good too...