COVID-19 Tracker

COVID-19 Tracker

thingiverse

Human: COVID-19 Tracker for At-a-glance : https://youtu.be/viHVAZqpwsI C - Cases R - Recovered D - Deaths LEDs fit snugly into holes designed for standard 5mm LEDs, with proper tolerance. If not, a quick blast of heat from a lighter on the standoffs allows the LED to fit. Here's a rough example of code that runs flashing LEDs: ```python import requests import json import RPi.GPIO as GPIO from time import sleep import threading CURRENT_DATA = {} ACTIVE_PINS = {"cases": 22, "recovered": 18, "deaths": 17} CHANGE_INDICATOR_ENABLE = False DATA_API_URL = "https://coronavirus-19-api.herokuapp.com/all" def get_data(): """This method obtains current data for COVID-19 from a reputable source. The return should be a JSON payload in the format of {"cases":n, "recovered":n, "deaths":n}. If this does not match, adjust the GPIO pin reference in ACTIVE_PINS to match the indicator lights based on the GPIO pin for each LED. :return: n/a - starts a thread to blink the GPIO pins.""" response = json.loads(requests.get(DATA_API_URL).text) print(response) if CURRENT_DATA != response: for key, value in response.items(): if key not in CURRENT_DATA.keys(): CURRENT_DATA[key] = value print('value was not found for %s, now added' % key) else: if response[key] != CURRENT_DATA[key]: print("%s is not matching" % key) threading.Thread(name=key, target=record_new_numbers, args=(key, value)).start() def record_new_numbers(key, value): increment_number = 0 print('adding %s, have %s need %s' % (key, CURRENT_DATA[key], value)) while CURRENT_DATA[key] < value: CURRENT_DATA[key] += 1 increment_number += 1 blink_n_times(ACTIVE_PINS[key], increment_number) def blink_n_times(gpio_number, blink_times): already_blunk = 0 # Long enable to indicate this is a new number increment. blink_gpio(gpio_number, delay=3) if CHANGE_INDICATOR_ENABLE else None while blink_times > already_blunk: already_blunk += 1 blink_gpio(gpio_number) def blink_gpio(number, delay=0.1, secondary_delay=0.1): GPIO.output(number, GPIO.HIGH) sleep(delay) GPIO.output(number, GPIO.LOW) sleep(secondary_delay) def setup_gpio(): GPIO.setmode(GPIO.BCM) for k, v in ACTIVE_PINS.items(): GPIO.setup(v, GPIO.OUT) GPIO.output(v, GPIO.HIGH) sleep(0.4) GPIO.output(v, GPIO.LOW) print("setup pin %s for %s" % (v, k)) if __name__ == '__main__': setup_gpio() print('Setup of GPIO pins complete') try: while True: get_data() sleep(30) except KeyboardInterrupt: GPIO.cleanup() ``` C - Cases R - Recovered D - Deaths

Download Model from thingiverse

With this file you will be able to print COVID-19 Tracker with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on COVID-19 Tracker.