If you want to follow the situation with regard to the distribution of COVID-19 24/7, you can use a microcontroller for this. Together with an OLED, you can compile a live COVID-19 CORONA Tracker.
Watch this video on YouTube
Here is example hot to track covid19 status. I make API with data for current situation in World and in Serbia
Api is HERE
I return data in format:
{
"counryConfirmed": 1060,
"counryDeaths": 28,
"counryRecovered": 42,
"counrycritical": 62,
"totalConfirmed": "918232",
"totalDeaths": "46072",
"totalRecovered": "193351",
"totalcritical": "34881"
}
Original API source is https://covid-19-data.p.rapidapi.com, and I adopt it to my needs.
To show data I use OLED display 128x64 linked with WEMOS d1 mini. Here is schematic:
Here is source code(a bit confused, I put images on same file, sorry):
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include <Wire.h>
#include "SSD1306.h"
#include "font.h"
#include "OLEDDisplayUi.h"
#include "SSD1306Wire.h"
int counryConfirmed=0;
int counryDeaths=0;
int counryRecovered=0;
int counrycritical=0;
long totalConfirmed=0;
long totalDeaths=0;
long totalRecovered=0;
long totalcritical=0;
int counter=100000;
#define covid19_width 127
#define covid19_height 64
#define ogiws_width 100
#define ogiws_height 64
const uint8_t covid19_bits[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x83, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE1, 0x83,
0x83, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xE0, 0xE1, 0xC1, 0x87, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x80, 0xFF, 0xFF, 0x03, 0x1E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x80, 0xFF,
0xFF, 0x03, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFC, 0xC1, 0x0F, 0xE0, 0x07, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xF3, 0x01, 0x00, 0x9F, 0x37, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7F, 0x00,
0x00, 0xFC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3F, 0x80, 0x03, 0xF8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xC0, 0x07, 0xE0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0,
0x07, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xC7, 0x87, 0x83, 0xC7, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0xE3, 0x07, 0xC0, 0x8F, 0x33, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xE1, 0x0E,
0xE0, 0x0E, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFC, 0x61, 0x0C, 0x60, 0x0C, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x60, 0x0E, 0xE0, 0x0C, 0xFE, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x0F,
0xE0, 0x0F, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0xC0, 0x07, 0xC0, 0x07, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x00, 0xC0,
0x07, 0x00, 0x1C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x60, 0x70, 0x00, 0xE0, 0x07, 0x00, 0x1C, 0x0C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x3C, 0xE0, 0x0E, 0x78, 0x1C, 0x0C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x7F, 0x3C, 0x60,
0x0C, 0x78, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xE0, 0x7F, 0x3C, 0x60, 0x0C, 0x78, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x18, 0xE0, 0x0F, 0x30, 0x1C, 0x0C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x00, 0xC0,
0x07, 0x00, 0x1C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x03, 0x80, 0x03, 0x0C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC0, 0x07,
0xC0, 0x07, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xEC, 0xE0, 0x0F, 0xE0, 0x0E, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x60, 0x0C, 0x60, 0x0C, 0x7E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x61, 0x0E,
0xE0, 0x0C, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x9C, 0xE3, 0x0F, 0xE0, 0x8F, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xC3, 0x87, 0xC3, 0x87, 0x33, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC1,
0x07, 0xC1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0E, 0xC0, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x80, 0x07, 0xF0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00,
0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x88, 0xF7, 0x00, 0x00, 0x9E, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xE1, 0x03, 0x80, 0x0F, 0x77, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xC0, 0x7F,
0xFC, 0x03, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF0, 0x80, 0xFF, 0xFF, 0x03, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC0, 0xF3, 0x1F, 0x0F, 0x0E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE1, 0x83,
0x83, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xC0, 0x83, 0x83, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x83, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8_t ogiws_bits[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x01, 0xE0, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x7C, 0x04, 0x0F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x10, 0x24,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x81, 0x21,
0x22, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x22,
0x23, 0x22, 0xC3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB8,
0x61, 0x02, 0xA2, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4C, 0x20, 0x00, 0x40, 0x38, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC6, 0x09, 0x00, 0x00, 0x48, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x83, 0x06, 0x00, 0x00, 0x94, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x04, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x1C, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00,
0x48, 0x00, 0x00, 0x00, 0xC0, 0x12, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00,
0x00, 0xDF, 0x00, 0x00, 0x00, 0x60, 0x39, 0x00, 0x00, 0x00, 0x00, 0x1F,
0x00, 0xF0, 0x9F, 0x00, 0x00, 0x00, 0x20, 0x06, 0x00, 0x00, 0x00, 0xE0,
0x01, 0x00, 0x7E, 0x9E, 0x00, 0x00, 0x00, 0x30, 0x04, 0x00, 0x00, 0x00,
0x3C, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00,
0xC0, 0x07, 0x00, 0xF0, 0x00, 0x30, 0x02, 0x00, 0x00, 0x18, 0x00, 0x00,
0x00, 0xF8, 0x00, 0x08, 0xC4, 0xF7, 0xFF, 0x0C, 0x00, 0x00, 0xC8, 0x02,
0x00, 0x00, 0x1F, 0x00, 0x18, 0xFC, 0xFF, 0xFF, 0x0D, 0x00, 0x00, 0x4C,
0x02, 0x00, 0xE0, 0x01, 0x00, 0x18, 0xFC, 0xFF, 0xFF, 0x0C, 0x00, 0x00,
0x24, 0x02, 0x00, 0x3C, 0x00, 0x00, 0x08, 0xF8, 0x03, 0x7F, 0x06, 0x00,
0x00, 0x64, 0x02, 0xC0, 0x07, 0x00, 0x10, 0x09, 0x00, 0x9C, 0xBF, 0x01,
0x00, 0x00, 0xC6, 0x01, 0xF8, 0x00, 0x70, 0xEE, 0x00, 0x80, 0xFF, 0x67,
0x00, 0x00, 0x00, 0x06, 0x00, 0x0F, 0x00, 0xF0, 0x33, 0x00, 0xE0, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x02, 0xE0, 0x01, 0x00, 0xFC, 0xCF, 0x00, 0xE0,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3E, 0x00, 0x80, 0x7F, 0x00, 0x00,
0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x07, 0x00, 0x00, 0x38, 0x9F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x00, 0x00, 0x13, 0x88,
0x9F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x40, 0x23,
0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE,
0x6F, 0xE0, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
0xFB, 0x07, 0xC0, 0xFF, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF8, 0x7F, 0x98, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFE, 0x00, 0x9B, 0xE1, 0x0F, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xF0, 0x3F, 0xC1, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xF9, 0x7F, 0x03, 0x00, 0xC0, 0x1B, 0x00, 0x00,
0x00, 0x00, 0xC0, 0x27, 0xFF, 0xF3, 0x7F, 0x00, 0x00, 0x78, 0x08, 0x00,
0x00, 0x00, 0x00, 0xFE, 0x4F, 0xFE, 0xC7, 0x9F, 0x01, 0x80, 0x0F, 0x08,
0x00, 0x00, 0x00, 0xC0, 0xFF, 0xDF, 0xDE, 0xF7, 0x67, 0x00, 0xF0, 0x01,
0x08, 0x00, 0x00, 0x00, 0xF0, 0xEF, 0x9F, 0xFD, 0xFF, 0x08, 0x00, 0x1E,
0x30, 0x0C, 0x00, 0x00, 0x00, 0xFC, 0xF1, 0x3F, 0xF9, 0x1F, 0x00, 0xC0,
0x03, 0x20, 0x04, 0x00, 0x00, 0x00, 0xFE, 0xE1, 0x7F, 0xE3, 0x03, 0x00,
0x7C, 0x00, 0x28, 0x04, 0x00, 0x00, 0x00, 0xF3, 0xC3, 0x7F, 0x02, 0x00,
0x80, 0x0F, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0xFB, 0xC3, 0x7F, 0x03,
0x00, 0xF0, 0x01, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0xFE, 0x87, 0x9F,
0x01, 0x00, 0x1E, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x00, 0x00, 0xFC, 0xEF,
0x67, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x12, 0x01, 0x00, 0x00, 0x00, 0xFC,
0xFF, 0x19, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00,
0xF8, 0x3F, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xC9, 0x00, 0x00, 0x00,
0x00, 0xE0, 0x03, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x40, 0x46, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x80, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x48, 0x31,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x32,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x00,
0x21, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x56, 0x01,
0xA0, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xB0,
0xEC, 0x15, 0x0C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x90, 0x28, 0x0D, 0xC3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC0, 0x81, 0xE8, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x26, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF0, 0x01, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, };
SSD1306Wire display(0x3c, D2, D1);
// SH1106Wire display(0x3c, D3, D5);
OLEDDisplayUi ui ( &display );
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {
}
void drawFrame0(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
// draw an xbm image.
// Please note that everything that should be transitioned
// needs to be drawn relative to x and y
display->clear();
display->drawXbm(10 , 0 , ogiws_width, ogiws_height, ogiws_bits);
}
void drawFrame1(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
// draw an xbm image.
// Please note that everything that should be transitioned
// needs to be drawn relative to x and y
display->clear();
display->drawXbm(0 , 0 , covid19_width, covid19_height, covid19_bits);
}
void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
display->clear();
// Demonstrates the 3 included default sizes. The fonts come from SSD1306Fonts.h file
// Besides the default fonts there will be a program to convert TrueType fonts into this format
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_16);
display->drawString(0, 0, "covid19 Serbia");
display->setFont(ArialMT_Plain_10);
display->drawString(0 + x, 16 + y, "Confirmed: "+String(counryConfirmed));
display->setFont(ArialMT_Plain_10);
display->drawString(0 + x, 26 + y, "Deaths: " + String(counryDeaths));
display->setFont(ArialMT_Plain_10);
display->drawString(0 + x, 36 + y, "Recovered: " + String(counryRecovered));
}
void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
display->clear();
// Demonstrates the 3 included default sizes. The fonts come from SSD1306Fonts.h file
// Besides the default fonts there will be a program to convert TrueType fonts into this format
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_16);
display->drawString(0, 0, "covid19 World");
display->setFont(ArialMT_Plain_10);
display->drawString(0 + x, 16 + y, "Confirmed: "+String(totalConfirmed));
display->setFont(ArialMT_Plain_10);
display->drawString(0 + x, 26 + y, "Deaths: " + String(totalDeaths));
display->setFont(ArialMT_Plain_10);
display->drawString(0 + x, 36 + y, "Recovered: " + String(totalRecovered));
}
void drawFrame4(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
// Demo for drawStringMaxWidth:
// with the third parameter you can define the width after which words will be wrapped.
// Currently only spaces and "-" are allowed for wrapping
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_10);
display->drawStringMaxWidth(0 + x, 10 + y, 128, "Lorem ipsum\n dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore.");
}
// This array keeps function pointers to all frames
// frames are the single views that slide in
FrameCallback frames[] = { drawFrame0,drawFrame1,drawFrame2,drawFrame3 };
// how many frames are there?
int frameCount = 4;
// Overlays are statically drawn on top of a frame eg. a clock
OverlayCallback overlays[] = { msOverlay };
int overlaysCount = 1;
const char* ssid = "CiraSoft";
const char* password = "11111111";
const uint8_t activeSymbol[] PROGMEM = {
B00000000,
B00000000,
B00011000,
B00100100,
B01000010,
B01000010,
B00100100,
B00011000
};
const uint8_t inactiveSymbol[] PROGMEM = {
B00000000,
B00000000,
B00000000,
B00000000,
B00011000,
B00011000,
B00000000,
B00000000
};
void setup() {
Serial.begin(115200);
// The ESP is capable of rendering 60fps in 80Mhz mode
// but that won't give you much time for anything else
// run it in 160Mhz mode or just set it to 30 fps
ui.setTargetFPS(60);
// Customize the active and inactive symbol
ui.setActiveSymbol(activeSymbol);
ui.setInactiveSymbol(inactiveSymbol);
// You can change this to
// TOP, LEFT, BOTTOM, RIGHT
ui.setIndicatorPosition(BOTTOM);
// Defines where the first frame is located in the bar.
ui.setIndicatorDirection(LEFT_RIGHT);
// You can change the transition that is used
// SLIDE_LEFT, SLIDE_RIGHT, SLIDE_UP, SLIDE_DOWN
ui.setFrameAnimation(SLIDE_LEFT);
// Add frames
ui.setFrames(frames, frameCount);
// Add overlays
ui.setOverlays(overlays, overlaysCount);
// Initialising the UI will init the display too.
ui.init();
WiFi.begin(ssid, password);
display.init();
display.flipScreenVertically();
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
display.drawString(20, 20, "Connecting...");
display.display();
}
}
void loop() {
int remainingTimeBudget = ui.update();//TimeBudget depending of tasks which you plan to do, this is important to transition work fine
if (remainingTimeBudget > 0) {
counter++;
if (counter>100000){//call api periodicly
// Check WiFi Status
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http; //Object of class HTTPClient
http.begin("http://esp8266home.cirasoft.net/covid19/");
int httpCode = http.GET();
//Check the returning code
if (httpCode > 0) {
// Get the request response payload
String payload = http.getString();
Serial.println(payload);
const size_t capacity = JSON_OBJECT_SIZE(8) + 190;
DynamicJsonDocument doc(capacity);
char buf[payload.length()];
payload.toCharArray(buf, payload.length());
const char* json = buf;
deserializeJson(doc, json);
totalConfirmed = doc["totalConfirmed"]; // 701525
totalDeaths = doc["totalDeaths"]; // 33174
totalRecovered = doc["totalRecovered"]; // 141916
totalcritical = doc["totalcritical"]; // "2020-03-29T17:02:01.442Z"
counryConfirmed = doc["counryConfirmed"]; // 741
counryDeaths = doc["counryDeaths"]; // 13
counryRecovered = doc["counryRecovered"]; // 42
counrycritical = doc["counrycritical"]; // "2020-03-29T17:02:01.442Z"
}
http.end(); //Close connection
}
counter=0;
}
delay(remainingTimeBudget);
}
}
Comments
Please log in or sign up to comment.