Let’s get and display weather informattion [Block Program]
Contents
Make things
Let’s make a program to get and display weather information such as clear, clouds, and rain from the Internet.
Materials
- obniz Board
- smartphone or PC
- power supply for obniz
How to make
Hardware connection
Connect a power supply to an obniz Board. No parts are needed.
Software
Use “weather block” in the AI category. You can set favorite words on the part of “xxx” in a “Print “xxx” on obniz” block.
Change the area(city name)
In the program, the weather in Tokyo will be shown on an obniz Board display. If you want to set another country, change the value of the “if” block.
For example, change the value to “hakodate” to get the weather in Hakodate City, and “naha-shi” to get it in Naha City.
The weather block uses Weather API provided from OpenWeatherMap service. Try to look for the city that you can get weather information from the link below.
Program
How to use
If you click on the Run button, the weather will be displayed on the obniz Board display. The first line is “It’s”, the second line is depending on the weather on the display.
In this article, display the sentence on the obniz Board. You can also make a system that notifies the weather with moving and light using motors and LEDs such as the lesson of waving the flag from weather information.