TridentTD_OpenWeather is a library for ESP8266 , ESP32 board
to get Weather Status at any place by latitude, longitude
from OpenWeatherMap API in the simplest method.
Clone (or download and unzip) the repository to ~/Documents/Arduino/libraries
where ~/Documents/Arduino is your sketchbook directory.
> cd ~/Documents/Arduino
> mkdir libraries
> cd libraries
> git clone https://github.com/TridentTD/TridentTD_OpenWeather.git TridentTD_OpenWeather
and install ArduinoJson library version 6.x
You need to have the ESP8266 or ESP32board support already included.
#include <TridentTD_OpenWeather.h>Constructor to create an TridentTD_OpenWeather object.
TridentTD_OpenWeather myPlace(OpenWeather_APIKEY);Setup the ESP8266 board's wifi to the ssid .
However you can connect by yourself.
myPlace.wificonnect( ssid,password );Set up your location by latitude and longitude.
myPlace.setLocation( lat, lon );Set up unit type. By default "metric" (celcius, meter/sec).
Or "imperial" (fahrenheit, miles/hour)
myPlace.setUnit("metric");
myPlace.setUnit("imperial");Get weather information of your place at now.
myPlace.weatherNow(); Serial.println("[OpenWeather] Location : " + myPlace.latitude() + ", "+ myPlace.longitude() );
Serial.println("[OpenWeather] Temperature: " + String(myPlace.readTemperature())); // [metric] Celcius or [imperial] Fahrenheit
Serial.println("[OpenWeather] Temp Min : " + String(myPlace.readTempMin())); // [metric] Celcius or [imperial] Fahrenheit
Serial.println("[OpenWeather] Temp Max : " + String(myPlace.readTempMax())); // [metric] Celcius or [imperial] Fahrenheit
Serial.println("[OpenWeather] Feels-Like : " + String(myPlace.readTempFeelsLike())); // [metric] Celcius or [imperial] Fahrenheit
Serial.println("[OpenWeather] Humidity : " + String(myPlace.readHumidity())); // %
Serial.println("[OpenWeather] Pressure : " + String(myPlace.readPressure())); // hPa
Serial.println("[OpenWeather] Weather : " + myPlace.readWeather());
Serial.println("[OpenWeather] Wind Speed : " + String(myPlace.readWindSpeed())); // [metric] meter/sec or [imperial] miles/hour
Serial.println("[OpenWeather] Wind Deg : " + String(myPlace.readWindDeg())); // degrees
Serial.println("[OpenWeather] Cloudiness : " + String(myPlace.readCloudiness())); // %
Serial.println("[OpenWeather] Sunrise : " + String(myPlace.readSunrise(timezone)));
Serial.println("[OpenWeather] Sunset : " + String(myPlace.readSunset(timezone)));
Serial.println("[OpenWeather] DateTime : " + String(myPlace.readDateTime(timezone)));Get version of this library.
myPlace.getVersion();1.0.0 TridentTD_OpenWeather
2.0.0 support ESP32
3.0.0 json parser by ArduinoJson 6.x
@ 6 May 2563 BE (Buddhism Era) / 2020
Ven. Phaisarn Techajaruwong