Introduction
We hope you've all been staying safe by washing your hands thoroughly and methodically. You may have spotted various projects on the internet with the goal of protecting from and educating yourself on the Coronavirus situation. These projects ranged from hand-washing timers to coronavirus counters.
In this guide, we'll show you how to build your own such counter or monitor using the simple to use COVID-19 web API with a Raspberry Pi, a display and some momentary pushbuttons.Â
Complete this guide to get started with creating your own COVID-19 monitor.
In this guide, we'll show you how to build your own such counter or monitor using the simple to use COVID-19 web API with a Raspberry Pi, a display and some momentary pushbuttons.Â
Complete this guide to get started with creating your own COVID-19 monitor.
Tools
-
-
-
-
import requests import time from gpiozero import Button btn1 = Button(2) btn2 = Button(3) btn3 = Button(4) while True: if btn1.is_pressed: # Get data on only confirmed cases for location ID 15: Victoria, Australia api_response = requests.get('https://covid19api.herokuapp.com/confirmed') print("Number of confirmed cases:") print(api_response.json()['locations'][14]['latest'])
-
import requests import time from gpiozero import Button btn1 = Button(2) btn2 = Button(3) btn3 = Button(4) while True: if btn1.is_pressed: # Get data on only confirmed cases for location ID 15: Victoria, Australia api_response = requests.get('https://covid19api.herokuapp.com/confirmed') print("Number of confirmed cases:") print(api_response.json()['locations'][14]['latest']) if btn2.is_pressed: # Get data on recoveries for location ID 15: Victoria, Australia api_response = requests.get('https://covid19api.herokuapp.com/recovered') print("Number of recoveries:") print(api_response.json()['locations'][14]['latest'])
-
import requests import time from gpiozero import Button btn1 = Button(2) btn2 = Button(3) btn3 = Button(4) while True: if btn1.is_pressed: # Get data on only confirmed cases for location ID 15: Victoria, Australia api_response = requests.get('https://covid19api.herokuapp.com/confirmed') print("Number of confirmed cases:") print(api_response.json()['locations'][14]['latest']) if btn2.is_pressed: # Get data on recoveries for location ID 15: Victoria, Australia api_response = requests.get('https://covid19api.herokuapp.com/recovered') print("Number of recoveries:") print(api_response.json()['locations'][14]['latest']) if btn3.is_pressed: #Get data on deaths for location ID 15: Victoria, Australia api_response = requests.get('https://covid19api.herokuapp.com/deaths') print("Number of deaths:") print(api_response.json()['locations'][14]['latest'])
-
-
-