Wanting to do something challenging and interesting on my IoT DevKit, I decided to do something with a COVID-19 theme (we have so little else to think about these days!).
My idea was simple: to get some statistics from the web and to display them on the built-in screen.
The first step was to choose a suitable API. I chose the “Novel COVID API“.
This API returns data in JSON format. So I need to choose a suitable library for parsing the data. I choose the ArduinoJSON library.
The next step was to decide how to present the data. The device only has a 4 line display with 16 characters per line. So I ended up creating a series of screens to show the data for each country, trying to group the data logically. Because the first line is a different colour, it was fairly obvious that I should reserve that for the country name.
The last step was to decide how to control the display. The device just has two buttons: A is on the left and B is on the right. I decided on the following:
- You would press button A to move from one country to the next one
- You would press button B to move from one screen to the next one
- You would press the two buttons at the same time to go back to the API to get fresh data
To be honest, I am quite pleased with the way the sketch turned out. You can see a video of it in action below. In the video you can see me viewing data for Ireland, USA, UK and the world.
The data which is shown is correct for today: 17th May 2020.
You can access the code here.