之前的8266粉丝数显示器的代码

点击下载

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <WiFiUdp.h>
#include <Wire.h>

#define OLED_MOSI  4  //D2
#define OLED_CLK   5  //D1
#define OLED_DC    0  //D3
#define OLED_CS    2  //D4
#define OLED_RESET 16 //D0

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define LOGO_WIDTH 128 
#define LOGO_HEIGHT 64 

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

const char *ssid = "XXX";          //WiFi名
const char *password = "XXXXXXXX";  //WiFi密码
String biliuid = "XXXXXXX";         //UID
String biliname = "XXXXX" ;         //Name
String responserelation;
String responsespace;

int Follower = 0;
int View = 0;
int uu=1,ss=1;

const unsigned long HTTP_TIMEOUT = 8000;
WiFiClient client;
HTTPClient http;
WiFiUDP udp;

static const unsigned char PROGMEM logo_bmp[] ={
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x01,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x01,0x00,0x00,0x80,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x3F,0x00,0x01,0xFC,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x0F,0xFF,0x80,0x01,0xFF,0xE0,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x1F,0xFF,0x80,0x01,0xFF,0xF8,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x1F,0xFF,0x80,0x03,0xFF,0xF8,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x1F,0xFF,0x80,0x01,0xFF,0xF0,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x1F,0xF0,0x00,0x00,0x0F,0xF0,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x0E,0x00,0x00,0x00,0x00,0x70,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x01,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x01,0x80,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0xC3,0xC7,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x01,0xEF,0xEF,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0xFF,0xFE,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x3C,0x7C,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x00,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x00,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x00,0x03,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00
};//bilibili TV

static const unsigned char PROGMEM btv1[] ={
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,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,
0x00,0x00,0xF8,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x7E,0x00,0x03,0xC0,0x00,0x00,
0x00,0x00,0x3F,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x0F,0xC0,0x07,0x80,0x00,0x00,
0x00,0x00,0x03,0xF0,0x0F,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x1E,0x00,0x00,0x00,
0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x00,
0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x00,0x03,0x87,0xFF,0xFF,0x00,0x00,0x07,0x00,
0x03,0x87,0xFF,0xFF,0xFF,0xFF,0xF7,0x00,0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF7,0x00,
0x03,0x9C,0x00,0x01,0xFF,0xFF,0xF7,0x00,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,
0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,0x03,0x9C,0x00,0x00,0x0C,0x00,0x77,0x00,
0x03,0x9C,0x01,0xC0,0x0F,0x80,0x77,0x00,0x03,0x9C,0x03,0xC0,0x0F,0xC0,0x77,0x00,
0x03,0x9C,0x07,0xC0,0x07,0xE0,0x77,0x00,0x03,0x9C,0x3F,0x00,0x00,0xF8,0x77,0x00,
0x03,0x9C,0x3E,0x00,0x00,0x78,0x77,0x00,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,
0x03,0x9C,0x01,0xC0,0x00,0x00,0x77,0x00,0x03,0x9C,0x01,0xC0,0x00,0x00,0x77,0x00,
0x03,0x9C,0x03,0xCF,0x00,0x00,0x73,0x80,0x03,0x9C,0x03,0x8F,0x8C,0x00,0x73,0x80,
0x03,0x9C,0x03,0x8F,0xCC,0x00,0x73,0x80,0x03,0x9C,0x03,0xDF,0xEC,0x00,0x73,0x80,
0x03,0x9C,0x01,0xFF,0xFC,0x00,0x73,0x80,0x03,0x9C,0x01,0xF8,0x7C,0x00,0x73,0x80,
0x03,0x9C,0x00,0xF0,0x7C,0x00,0x73,0x80,0x03,0x9C,0x00,0x00,0x00,0x00,0x73,0x80,
0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,
0x03,0x87,0xFF,0xFF,0xFF,0xFF,0xC3,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,
0x0F,0xFF,0xFC,0x00,0x00,0x00,0x03,0x80,0x0F,0xFF,0xFF,0xFF,0xFC,0x00,0x03,0x80,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x01,0x83,0x3F,0xFF,0xFF,0xFF,0xFF,0x80,
0x00,0x03,0x38,0x00,0x07,0xFF,0xFF,0x80,0x00,0x03,0xE0,0x00,0x00,0x3F,0x01,0x80,
0x00,0x03,0xE0,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1F,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};
  
static const unsigned char PROGMEM btv2[] ={
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,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,
0x00,0x00,0xF8,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x7E,0x00,0x03,0xC0,0x00,0x00,
0x00,0x00,0x3F,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x0F,0xC0,0x07,0x80,0x00,0x00,
0x00,0x00,0x03,0xF0,0x0F,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x1E,0x00,0x00,0x00,
0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x00,
0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x00,0x03,0x87,0xFF,0xFF,0x00,0x00,0x07,0x00,
0x03,0x87,0xFF,0xFF,0xFF,0xFF,0xF7,0x00,0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF7,0x00,
0x03,0x9C,0x00,0x01,0xFF,0xFF,0xF7,0x00,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,
0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,0x03,0x9C,0x00,0x00,0x0C,0x00,0x77,0x00,
0x03,0x9C,0x01,0xC0,0x0F,0x80,0x77,0x00,0x03,0x9C,0x03,0xC0,0x0F,0xC0,0x77,0x00,
0x03,0x9C,0x07,0xC0,0x07,0xE0,0x77,0x00,0x03,0x9C,0x3F,0x00,0x00,0xF8,0x77,0x00,
0x03,0x9C,0x3E,0x00,0x00,0x78,0x77,0x00,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,
0x03,0x9C,0x01,0xC0,0x00,0x00,0x77,0x00,0x03,0x9C,0x01,0xC0,0x00,0x00,0x77,0x00,
0x03,0x9C,0x03,0xCF,0x00,0x00,0x73,0x80,0x03,0x9C,0x03,0x8F,0x8C,0x00,0x73,0x80,
0x03,0x9C,0x03,0x8F,0xCC,0x00,0x73,0x80,0x03,0x9C,0x03,0xDF,0xEC,0x00,0x73,0x80,
0x03,0x9C,0x01,0xFF,0xFC,0x00,0x73,0x80,0x03,0x9C,0x01,0xF8,0x7C,0x00,0x73,0x80,
0x03,0x9C,0x00,0xF0,0x7C,0x00,0x73,0x80,0x03,0x9C,0x00,0x00,0x00,0x00,0x73,0x80,
0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,
0x03,0x87,0xFF,0xFF,0xFF,0xFF,0xC3,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,
0x0F,0xFF,0xFC,0x00,0x00,0x00,0x03,0x80,0x0F,0xFF,0xFF,0xFF,0xFC,0x00,0x03,0x80,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x01,0x83,0x3F,0xFF,0xFF,0xFF,0xFF,0x80,
0x00,0x03,0x38,0x00,0x07,0xFF,0xFF,0x80,0x00,0x03,0xE0,0x00,0x00,0x3F,0x01,0x80,
0x00,0x03,0xE0,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1F,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};
  
static const unsigned char PROGMEM btv3[] ={
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,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,
0x00,0x00,0xF8,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x7E,0x00,0x03,0xC0,0x00,0x00,
0x00,0x00,0x3F,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x1F,0xC0,0x07,0x80,0x00,0x00,
0x00,0x00,0x03,0xF0,0x0F,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x0E,0x00,0x00,0x00,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x80,
0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x03,0x83,0xFF,0xFF,0x80,0x00,0x07,0x80,
0x03,0x83,0xFF,0xFF,0xFF,0xFF,0xC7,0x80,0x03,0x9F,0xFF,0xFF,0xFF,0xFF,0xF7,0x80,
0x03,0x9C,0x00,0x00,0xFF,0xFF,0xF7,0x80,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x80,
0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x80,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x80,
0x03,0x9C,0x01,0xC0,0x0F,0x00,0x77,0x80,0x03,0x9C,0x07,0xC0,0x0F,0x80,0x77,0x80,
0x03,0x9C,0x0F,0xC0,0x0F,0xE0,0x77,0x80,0x03,0x9C,0x3F,0x00,0x01,0xE0,0x77,0x80,
0x03,0x9C,0x3C,0x00,0x00,0x60,0x77,0x80,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x80,
0x03,0x9C,0x01,0x8E,0x00,0x00,0x77,0x80,0x03,0x9C,0x03,0x8E,0x00,0x00,0x77,0x80,
0x03,0x9C,0x07,0x8E,0x00,0x00,0x77,0x80,0x03,0x9C,0x07,0x0F,0x0C,0x00,0x77,0x80,
0x03,0x9C,0x07,0x1F,0x8C,0x00,0x77,0x80,0x03,0x9C,0x07,0x1F,0xFC,0x00,0x77,0x80,
0x03,0x9C,0x07,0xFD,0xFC,0x00,0x77,0x80,0x03,0x9C,0x03,0xF8,0x7C,0x00,0x77,0x80,
0x03,0x9C,0x01,0xF8,0x38,0x00,0x77,0x80,0x03,0x9C,0x00,0x00,0x00,0x00,0x77,0x80,
0x03,0x9D,0xFF,0xFF,0xFF,0xFF,0xF7,0x80,0x03,0x9F,0xFF,0xFF,0xFF,0xFF,0xF7,0x80,
0x03,0x83,0xFF,0xFF,0xFF,0xFF,0xC7,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x80,
0x03,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,
0x00,0x03,0x38,0x00,0x00,0x73,0x87,0x80,0x00,0x03,0xF8,0x00,0x00,0x77,0x00,0x00,
0x00,0x03,0xC0,0x00,0x00,0x7F,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x3F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1C,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};
  
static const unsigned char PROGMEM btv4[] ={
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,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x00,
0x00,0x00,0xF8,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x7E,0x00,0x03,0xC0,0x00,0x00,
0x00,0x00,0x3F,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x1F,0xC0,0x07,0x80,0x00,0x00,
0x00,0x00,0x03,0xF0,0x0F,0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x0E,0x00,0x00,0x00,
0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x00,
0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x00,
0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x9F,0xFF,0xFF,0xFF,0xFF,0xE7,0x00,
0x07,0x9F,0xFF,0xFF,0xFF,0xFF,0xF7,0x00,0x07,0x9F,0xFF,0xFF,0xFF,0xFF,0xF7,0x00,
0x07,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,0x07,0x9C,0x00,0x00,0x00,0x00,0x77,0x00,
0x07,0x9C,0x00,0x00,0x0C,0x00,0x77,0x00,0x07,0x9C,0x01,0xC0,0x0E,0x00,0x77,0x00,
0x07,0x9C,0x07,0xC0,0x0F,0x80,0x77,0x00,0x07,0x9E,0x3F,0x80,0x07,0xE0,0x77,0x00,
0x07,0x8E,0x7E,0x00,0x03,0xF0,0x77,0x00,0x07,0x8E,0x70,0x00,0x00,0x78,0x77,0x00,
0x07,0x8E,0x00,0x00,0x00,0x38,0x77,0x00,0x07,0x8E,0x01,0x80,0x00,0x00,0x77,0x80,
0x07,0x8E,0x03,0x87,0x83,0x00,0x73,0x80,0x07,0x8E,0x03,0x87,0x87,0x00,0x73,0x80,
0x07,0x8E,0x03,0x87,0x8F,0x00,0x73,0x80,0x07,0x8F,0x03,0x87,0xCE,0x00,0x73,0x80,
0x07,0x87,0x03,0x8F,0xCE,0x00,0x73,0x80,0x07,0x87,0x03,0xFF,0xFC,0x00,0x73,0x80,
0x07,0x87,0x01,0xFE,0xFC,0x00,0x73,0x80,0x07,0x87,0x00,0x38,0x00,0x00,0x73,0x80,
0x07,0x87,0xFF,0xFF,0x00,0x00,0x73,0x80,0x07,0x87,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,
0x07,0x87,0xFF,0xFF,0xFF,0xFF,0xC3,0x80,0x07,0x83,0x00,0x01,0xFF,0xFF,0xC3,0x80,
0x07,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x07,0x80,0x00,0x00,0x00,0x00,0x03,0x80,
0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x06,0xF8,0x00,0x00,0x3B,0x00,0x00,
0x00,0x01,0xF8,0x00,0x00,0x3F,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x3F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,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};
  
static const unsigned char PROGMEM btv5[] ={
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,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,
0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0xE0,0x00,0x00,
0x00,0x00,0x1F,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x07,0xC0,0x03,0xE0,0x00,0x00,
0x00,0x00,0x03,0xF0,0x03,0x80,0x00,0x00,0x00,0x00,0x01,0xF0,0x07,0x80,0x00,0x00,
0x00,0x00,0x00,0x3C,0x0F,0x00,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,
0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,
0x03,0x80,0x00,0x00,0x00,0x00,0x01,0xC0,0x03,0x80,0x00,0x00,0x00,0x00,0x01,0xC0,
0x03,0x83,0xFF,0xFF,0x00,0x00,0x01,0xC0,0x03,0x83,0xFF,0xFF,0xFF,0xFF,0xF1,0xC0,
0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xF1,0xC0,0x03,0x8E,0x00,0x01,0xFF,0xFF,0xF1,0xC0,
0x03,0x8E,0x00,0x00,0x00,0x00,0x71,0xC0,0x03,0x8E,0x00,0x00,0x00,0x00,0x71,0xC0,
0x03,0x8E,0x01,0xC0,0x07,0x00,0x71,0xC0,0x03,0x8E,0x01,0xC0,0x07,0x80,0x71,0xC0,
0x03,0x8E,0x03,0xC0,0x07,0xE0,0x71,0xC0,0x03,0x8E,0x0F,0x80,0x01,0xFC,0x71,0xC0,
0x03,0x8E,0x1F,0x00,0x00,0x7C,0x71,0xC0,0x03,0x8E,0x3C,0x00,0x00,0x00,0x71,0xC0,
0x03,0xCE,0x38,0x00,0x00,0x00,0x71,0xC0,0x01,0xCE,0x00,0x03,0x00,0x00,0x73,0xC0,
0x01,0xCE,0x01,0xC3,0x80,0x00,0x73,0x80,0x01,0xCE,0x01,0xC3,0x80,0x00,0x73,0x80,
0x01,0xCE,0x01,0xC3,0xC7,0x00,0x73,0x80,0x01,0xCE,0x01,0xE7,0xE7,0x00,0x73,0x80,
0x01,0xCE,0x01,0xFF,0xF7,0x00,0x73,0x80,0x01,0xCE,0x00,0x7E,0x7E,0x00,0x73,0x80,
0x01,0xCE,0x00,0x3C,0x7E,0x00,0x73,0x80,0x01,0xCE,0x00,0x00,0x0C,0x00,0x73,0x80,
0x01,0xCF,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,0x01,0xCF,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,
0x01,0xC7,0xFF,0xFF,0xFF,0xFF,0xF3,0x80,0x01,0xC0,0x00,0x00,0x00,0x00,0x03,0x80,
0x01,0xC0,0x00,0x00,0x00,0x00,0x03,0x80,0x07,0xFF,0xFF,0xFE,0x00,0x00,0x03,0x80,
0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,
0x00,0x01,0x88,0x03,0xFF,0xFF,0xFF,0x80,0x00,0x03,0xFC,0x00,0x00,0x1F,0x03,0x00,
0x00,0x03,0xFC,0x00,0x00,0x1F,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x1F,0x80,0x00,
0x00,0x03,0x80,0x00,0x00,0x1F,0x80,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}; //bilibili gif TV

static const unsigned char PROGMEM fkunlogo[] ={  
0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x7F,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x70,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xE0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x30,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x30,0xE0,0x0F,0xFF,
0xFC,0x00,0x00,0x00,0x0F,0xC0,0x00,0x30,0xE0,0x3F,0xFF,0xFC,0x07,0x80,0x00,0x3F,
0xF0,0x00,0x30,0xE0,0x7C,0x00,0x00,0x07,0xC0,0x00,0x3F,0xF8,0x00,0x30,0xE0,0xF0,
0x00,0x00,0x0F,0xE0,0x00,0x3F,0xF8,0x00,0x30,0xE0,0xE0,0x00,0x00,0x1F,0xE0,0x00,
0x3F,0xF8,0x00,0x30,0xE0,0xE0,0x00,0x00,0x0F,0xE0,0x00,0x3F,0xF8,0x00,0x30,0xE0,
0xE0,0x00,0x00,0x07,0xC0,0x00,0x7F,0xF8,0x00,0x30,0xE0,0xE0,0x00,0x00,0x07,0xE0,
0x00,0xFF,0xF0,0x00,0x30,0xE0,0xE0,0x00,0x00,0x00,0x70,0x01,0xEF,0xF0,0x00,0x30,
0xE0,0xE0,0x00,0x00,0x00,0x38,0x03,0xC3,0xF0,0x00,0x30,0xE0,0xE0,0x00,0x00,0x00,
0x0C,0x0F,0x00,0x38,0x00,0x30,0xE0,0xE0,0x00,0x00,0x00,0x06,0x1C,0x00,0x1C,0x00,
0x30,0xE0,0xE0,0x00,0x00,0x00,0x03,0x38,0x00,0x0C,0x00,0x30,0xE0,0xE0,0x00,0x00,
0x00,0x01,0xE0,0x00,0x06,0x00,0x30,0xE0,0xE0,0x00,0x00,0x00,0x03,0xE0,0x00,0x03,
0x80,0x30,0xE0,0xE0,0x00,0x00,0x00,0x01,0xE0,0x00,0x03,0xC0,0x30,0xE0,0xE0,0x00,
0x00,0x00,0x01,0xC0,0x00,0x01,0x80,0x30,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xE0,0xFF,
0xFF,0xF0,0x00,0x0E,0x00,0x00,0x08,0x00,0x30,0xE0,0xFF,0xFF,0xFC,0x00,0x3F,0xC0,
0x00,0x7F,0x00,0x30,0xE0,0xFF,0xFF,0xFC,0x00,0xFF,0xE0,0x00,0xFF,0xC0,0x30,0xE0,
0xE0,0x00,0x1C,0x01,0xF0,0xF0,0x01,0xE3,0xE0,0x30,0xE0,0xE0,0x00,0x1C,0x01,0xC0,
0x70,0x03,0x80,0xE0,0x30,0xE0,0xE0,0x00,0x1C,0x03,0x80,0x38,0x03,0x80,0x70,0x30,
0xE0,0xE0,0x00,0x1C,0x07,0x00,0x38,0x03,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x0F,
0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x1E,0x00,0x38,0x07,0x00,0x70,
0x30,0xE0,0xE0,0x00,0x1C,0x3C,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,
0x78,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0xF0,0x00,0x38,0x07,0x00,
0x70,0x30,0xE0,0xE0,0x00,0x1D,0xE0,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,
0x1F,0xC0,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1F,0x80,0x00,0x38,0x07,
0x00,0x70,0x30,0xE0,0xE0,0x00,0x1F,0xC0,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,
0x00,0x1F,0xE0,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0xF0,0x00,0x38,
0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x78,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,
0xE0,0x00,0x1C,0x3C,0x00,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x1E,0x00,
0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x0F,0x00,0x38,0x07,0x00,0x70,0x30,
0xE0,0xE0,0x00,0x1C,0x07,0x80,0x38,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x03,
0xC0,0x3C,0x07,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x01,0xE0,0x1E,0x0E,0x00,0x70,
0x30,0xE0,0xE0,0x00,0x1C,0x00,0xF0,0x0F,0xFE,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,
0x00,0x78,0x07,0xFC,0x00,0x70,0x30,0xE0,0xE0,0x00,0x1C,0x00,0x3C,0x01,0xF0,0x00,
0x70,0x30,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xE0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x7F,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xE0,  
};  

void setup()
{
    Serial.begin(9600);
    
    while (!Serial)
        continue;
    Serial.println("BILIBILI FANS MONITOR V2.0");

    if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
    }
    display.clearDisplay(); 
    Serial.println("OLED Ready");
    int w= 64;
       while (w--)
       {
       display.clearDisplay();
       display.drawBitmap(0, w, logo_bmp,LOGO_WIDTH, LOGO_HEIGHT,WHITE );
       display.display();
       delay(20);
       }
       delay(1000);
       display.clearDisplay();
       
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 2);
    display.println(F("BILIBILI DATA MONITOR"));
    display.display();
    delay(1000);
    display.setCursor(0, 15);
    display.println(F("OLED........Ready!"));
    display.display();
    delay(500);
    display.setCursor(0, 25);
    display.println(F("SYSTEM......Ready!"));
    display.display();
    delay(500);
    display.setCursor(0, 35);
    display.print(F("WiFi info"));
    display.display();
    delay(100);    
    display.println(F(":"));
    display.display();
    delay(500);
    display.setCursor(0, 45);
    display.print(F("SSID:"));
    display.display();
    delay(200);
    display.println(ssid);
    display.display();
    delay(500);
    display.setCursor(0, 55);
    display.print(F("PASSWORD:"));
    display.display();
    delay(200);

    int t=10;
    while(t--)
    {
      display.print(F("*"));
      display.display();
      delay(40);
    }
    delay(800);
    Serial.print("Connecting WiFi...");
    display.clearDisplay(); 
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 21);
    display.print(F("Connecting WiFi..."));
    
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED){
        display.display();
        delay(500);
        Serial.print(".");
        display.print(F("."));
        
    }
    Serial.println("");
    Serial.print("WiFi connected");
       
       display.clearDisplay();
       display.setTextSize(2); // Draw 2X-scale text
       display.setTextColor(WHITE);
       display.setCursor(5, 25);
       display.print(F("Connected!"));
       display.display();
       delay(300);
       display.clearDisplay();
       display.display();
       delay(100);
       display.clearDisplay();
       display.setCursor(5, 25);
       display.print(F("Connected!"));
       display.display();
       delay(300);
       display.clearDisplay();
       display.display();
       delay(100);
       display.clearDisplay();
       display.setTextSize(2); // Draw 2X-scale text
       display.setTextColor(WHITE);
       display.setCursor(5, 25);
       display.print(F("Connected!"));
       display.display();
       delay(1000);
       display.clearDisplay();
       display.display();
       delay(300);
       
       Serial.print("IP address: ");
       Serial.println(WiFi.localIP());


     display.clearDisplay();
     display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 2);
    display.println(F("IP address:"));
    display.display();
    delay(500);
    display.setCursor(0, 15);
    display.println(WiFi.localIP());
    display.display();
    delay(1000);
    display.setCursor(0, 25);
    display.print(F("User info"));
    display.display();
    delay(100);    
    display.println(F(":"));
    display.display();
    delay(500);
    display.setCursor(0, 35);
    display.print(F("Bilibili ID:"));
    display.display();
    delay(200);
    display.println(biliname);
    display.display();
    delay(500);
    display.setCursor(0, 45);
    display.print(F("UID:"));
    display.display();
    delay(200);
    display.println(biliuid);
    display.display();
    delay(3000);
          
       

       
      int d=5;
       while(d--)
       { 
          btv();
       }
       display.clearDisplay(); 
       

       display.clearDisplay();
       display.drawBitmap(21, 0, fkunlogo,85, 60,WHITE );
       display.display();
       delay(3000);
}


bool getJson()
{
  bool r = false;
  http.begin("http://api.bilibili.com/x/relation/stat?vmid=" + biliuid); //relation api
  int httpCoderelation = http.GET();
  if (httpCoderelation > 0) {
 
      responserelation = http.getString();
      r = true;
 
  } else {

    r = false;
  }
  http.end();

  http.begin("http://api.bilibili.com/x/space/upstat?mid=" + biliuid);  //space api
  int httpCodespace = http.GET();
  if (httpCodespace > 0) {

      responsespace = http.getString();
      r = true;   
    
    }else{
        display.clearDisplay();
        display.println("API Busy, Please wait...");
        display.display();
        delay(500);

        r = false;
    }
    http.end();
    return r;

}

void parseJson(String json)
{
  const size_t capacity = JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(5) + 70;
  DynamicJsonDocument doc(capacity);
  deserializeJson(doc, json);

  int code = doc["code"];
  const char *message = doc["message"];

  JsonObject data = doc["data"];
  unsigned long data_mid = data["mid"];
  int data_follower = data["follower"];

  if (data_mid == 0) {
    delay(500);
    Serial.println("[JSON] FORMAT ERROR");

  }
  Follower = data_follower;
  
}

void parseJson1(String json)
{
  const size_t capacity = JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(5) + 70;
  DynamicJsonDocument doc(capacity);
  deserializeJson(doc, json);

  int code = doc["code"];
  const char *message = doc["message"];

  JsonObject data = doc["data"];
  JsonObject archive = data["archive"];
  int data_view = archive["view"];
  View = data_view;
}

void bilibilidata()
{       
        delay(1000);
        Serial.print("\nData from Bilibili API: \n");


        Serial.print("  follower: ");
        Serial.println(Follower);
        Serial.print("  View: ");
        Serial.println(View);
}


void btv()
{
      int dly=50;
      
      display.clearDisplay();
      display.drawBitmap(32, 0, btv1, 64, 64,WHITE );
      display.display();
      delay(dly);
      
      display.clearDisplay();
      display.drawBitmap(32, 0, btv2, 64, 64,WHITE );
      display.display();
      delay(dly);
      
      display.clearDisplay();
      display.drawBitmap(32, 0, btv3, 64, 64,WHITE );
      display.display();
      delay(dly);
      
      display.clearDisplay();
      display.drawBitmap(32, 0, btv4, 64, 64,WHITE );
      display.display();
      delay(dly);
      
      display.clearDisplay();
      display.drawBitmap(32, 0, btv5, 64, 64,WHITE );
      display.display();
      delay(dly);
}       



void loop()
   {                         
    
    if (WiFi.status() == WL_CONNECTED)
    {
        if (getJson())
        {
           parseJson(responserelation);
           parseJson1(responsespace);
           
               int y=64;
                while (y=y-2)
               {
                display.clearDisplay();
                display.setTextSize(2);
                display.setTextColor(WHITE);
                display.setCursor(15, 0);
                display.println(F("Followers"));
                display.setCursor(8, y+30);
                display.print(F(" "));
                display.setTextSize(3);
                display.println(Follower);
                display.display();
                delay(1);
                }
                delay(5000);
       
        int r=64;
       while (r=r-2)
       {
       display.clearDisplay();
       display.setTextSize(2); 
       display.setTextColor(WHITE);
       display.setCursor(40, 0);
       display.println(F("Views"));
       display.setCursor(0, r+30);
       display.print(F(" "));
       display.setTextSize(3);
       display.println(View);  
       display.display();
       delay(1);
       }
       delay(3000);    
            }
            
        } else
    {
        Serial.println("[WiFi] Waiting to reconnect...");
        display.clearDisplay();
        display.setTextSize(2);
        display.setCursor(0, 0);
        display.println("[WiFi] Waiting to reconnect...");
        display.display();
        delay(3000);
    }
    }

评论区

点踩数过多的评论会被枪毙

评论列表