This posting shows how to use API of OpenWeatherMap site
that provides weather information using WizArduino MEGA WiFi.
1. OpenWeatherMap API Key 획득
In order to use API, we need to acquire authority for use. We can usually access the Host system and use the resource using key issued by the Host system. We have to sign up on OpenWeatherMap website to get an API key.
Once we sign up, we can get an API key as shown below.
2. Installing Library
WizArduino MEGA WiFi requires WizFi310 Library to use WiFi function.
WizFi310 Library can be installed after searching ‘Sketch -> Include Library -> Manage Libraries..’.
3. Code 수정
(based on Arduino 1.8.1 version.)
The code needs some modification.
First, enter the API key from openweathermap site.
Configure the network by entering accessible wifi name and password. If the region isn’t Seoul in Korea, we can change variable value such as city and country to change the region.
Use the link below to find the city you want ^^
You can get the following results by turning on the serial monitor after uploading.
4. Application
4. Application
http://api.openweathermap.org/data/2.5/weather?q=Seoul,kr&appid=’API Key’
If you modify the API Key and access the above site with a web browser, you can check the weather information as text data as shown below. Among them, “temp” : 273.66,, “description” : “broken clouds” part has been extracted. If you want other data, you can modify the code to extract.
To extract other data, please change the part as shown below.
COMMENTS