Neeraj Rane
Published © CC BY-NC-SA

Retro Internet Radio using ESP32 & Transparent OLED Display

Made a Retro Internet Radio using ESP32 to replace my old FM Radio.

IntermediateFull instructions provided1,784
Retro Internet Radio using ESP32 & Transparent OLED Display

Things used in this project

Hardware components

ESP32S
Espressif ESP32S
×1
DFRobot Fermion: 1.51” OLED Transparent Display with Converter (Breakout)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Fusion
Autodesk Fusion
PCBWay

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Back Spacer

Battery Compartment

Front Spacer

Frame

Lid

Schematics

Schematics

Code

Code

Arduino
#include <WiFi.h>
#include <AudioFileSource.h>
#include <AudioFileSourceBuffer.h>
#include <AudioFileSourceICYStream.h>
#include <AudioGeneratorTalkie.h>
#include <AudioGeneratorMP3.h>
#include <AudioOutputI2S.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_CLK   18   //SCL
#define OLED_MOSI  23   //SDA
#define OLED_RESET 13   //RES
#define OLED_DC    26   //DC
#define OLED_CS    27   //CS

const char *SSID = "SSID";
const char *PASSWORD = "PASSWORD";
const int bufferSize = 16 * 1024; // buffer in byte, default 16 * 1024 = 16kb

#define FRAME_DELAY (42)
#define FRAME_WIDTH (32)
#define FRAME_HEIGHT (32)
#define FRAME_COUNT (28)
const byte PROGMEM wifi[][128] = {
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,31,248,54,56,120,30,28,17,192,3,136,3,0,0,192,2,15,240,64,1,56,28,128,1,224,7,128,0,131,193,0,0,15,240,0,0,24,24,0,0,8,16,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,240,0,0,240,15,0,3,128,1,192,14,0,0,112,24,31,248,24,96,240,15,6,195,128,1,195,102,31,248,102,60,120,30,60,17,192,3,136,3,0,0,192,2,15,240,64,3,60,60,192,1,224,7,128,0,128,1,0,0,7,224,0,0,24,24,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,31,248,0,1,224,7,128,7,0,0,224,28,0,0,56,48,63,252,12,96,224,7,6,195,0,1,195,102,15,240,102,56,127,254,28,16,224,7,8,3,128,1,192,7,7,224,224,3,30,120,192,1,240,15,128,0,192,3,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,2,64,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,31,248,0,1,252,63,128,7,128,1,224,30,0,0,120,56,31,248,28,96,240,15,6,195,128,1,195,198,0,0,99,124,0,0,62,48,0,0,12,0,0,0,0,0,3,192,0,0,31,248,0,0,96,6,0,0,192,3,0,1,143,241,128,0,248,31,0,0,96,6,0,0,7,224,0,0,28,56,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,0,192,3,0,1,7,224,128,6,63,252,96,12,224,7,48,5,128,1,160,3,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,3,192,0,0,13,176,0,0,31,248,0,0,24,24,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,192,0,0,8,16,0,0,36,36,0,0,23,232,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,128,0,0,15,240,0,0,24,24,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,15,240,0,0,31,248,0,0,24,24,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,240,0,0,56,28,0,0,195,195,0,1,159,249,128,3,112,14,192,1,192,3,128,0,0,0,0,0,0,0,0,0,0,0,0,0,15,240,0,0,28,56,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,248,0,0,120,30,0,1,128,1,128,6,0,0,96,28,31,248,56,48,224,7,12,51,128,1,204,30,0,0,120,12,0,0,48,0,0,0,0,0,0,0,0,0,7,192,0,0,28,56,0,0,48,12,0,0,103,230,0,0,60,60,0,0,31,248,0,0,24,24,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,31,248,0,1,252,63,128,7,128,1,224,30,0,0,120,56,31,248,28,96,240,15,6,195,128,1,195,198,0,0,99,124,0,0,62,48,0,0,12,0,7,224,0,0,60,60,0,0,224,7,0,1,128,1,128,1,15,240,128,1,176,13,128,0,224,7,0,0,0,0,0,0,7,224,0,0,28,56,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,31,248,0,1,224,7,128,7,0,0,224,28,0,0,56,48,63,252,12,96,224,7,6,195,0,1,195,102,15,240,102,56,127,254,28,16,224,7,8,3,128,1,192,7,7,224,224,3,30,120,192,1,240,15,128,0,192,3,0,0,0,0,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,2,64,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,240,0,0,240,15,0,3,128,1,192,14,0,0,112,24,31,248,24,96,240,15,6,195,128,1,195,102,31,248,102,60,120,30,60,17,192,3,136,3,0,0,192,2,15,240,64,3,60,60,192,1,224,7,128,0,128,1,0,0,7,224,0,0,24,24,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,31,248,54,56,120,30,28,17,192,3,136,3,0,0,192,2,15,240,64,1,56,28,128,1,224,7,128,0,131,193,0,0,15,240,0,0,24,24,0,0,8,16,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,252,0,1,192,3,128,7,0,0,224,28,7,224,56,48,127,254,12,97,192,3,134,195,0,0,195,108,7,224,54,56,63,252,28,16,224,7,8,1,128,1,128,3,7,224,192,3,30,120,192,1,240,15,128,0,192,3,0,0,7,224,0,0,12,48,0,0,24,24,0,0,12,48,0,0,6,96,0,0,3,192,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};

const byte PROGMEM play[][128] = {
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,56,0,24,16,60,0,8,48,55,0,12,32,49,192,4,32,48,112,4,32,48,28,4,96,48,14,6,96,48,3,134,96,48,3,134,96,48,14,6,32,48,24,4,32,48,96,4,32,49,192,4,48,55,0,12,16,60,0,8,24,56,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,7,224,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,32,12,48,0,48,24,56,0,24,16,46,0,8,48,35,128,12,32,33,224,4,32,32,112,4,96,32,28,4,96,32,7,6,96,32,3,134,96,32,3,134,96,32,7,6,32,32,28,4,32,32,120,4,32,32,224,4,48,35,128,12,16,46,0,8,24,60,0,24,12,48,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,124,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,32,0,48,24,56,0,24,16,46,0,8,48,35,128,12,32,33,192,4,32,32,112,4,96,32,28,4,96,32,7,6,96,32,1,134,96,32,3,134,96,32,14,6,32,32,28,4,32,32,112,4,32,33,192,4,48,35,128,12,16,62,0,8,24,56,0,24,12,48,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,28,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,56,0,24,16,60,0,8,48,55,0,12,32,49,192,4,32,48,112,4,96,48,28,4,96,48,14,4,96,48,3,134,96,48,3,134,96,48,14,6,32,48,24,4,32,48,96,4,32,49,192,4,48,55,0,12,16,60,0,8,24,56,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,0,0,0,224,1,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,23,0,12,32,17,128,4,32,16,96,4,96,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,96,4,32,17,128,4,48,23,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,0,0,0,224,0,0,1,128,0,0,3,0,0,0,6,0,0,0,12,0,0,16,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,96,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,0,0,0,224,0,0,1,128,0,0,3,0,0,0,6,0,0,0,12,0,0,0,24,16,0,0,16,28,0,0,48,22,0,0,32,17,128,0,32,16,224,0,96,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,0,0,0,224,0,0,1,128,0,0,3,0,0,0,6,0,0,0,12,0,0,0,24,16,0,0,16,28,0,0,48,22,0,0,32,17,128,0,32,16,224,0,96,16,56,0,96,16,12,0,96,16,3,0,96,16,3,0,96,16,12,0,32,16,56,0,32,16,224,0,32,17,128,0,48,22,0,0,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,32,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,192,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,0,0,0,224,0,0,1,128,0,0,3,0,0,0,6,0,0,0,12,0,0,0,24,16,0,0,16,28,0,0,48,22,0,0,32,17,128,0,32,16,224,0,96,16,56,0,96,16,12,0,96,16,3,0,96,16,3,0,96,16,12,0,32,16,56,0,32,16,224,0,32,17,128,0,48,22,0,0,16,28,0,0,24,16,0,0,12,0,0,0,6,0,0,0,3,0,0,0,1,128,0,0,0,224,0,0,0,63,240,0,0,7,192,0,0,0,0,0},
  {0,0,0,0,0,7,0,0,0,63,0,0,0,224,0,0,1,128,0,0,3,0,0,0,6,0,0,0,12,0,0,0,24,16,0,0,16,28,0,0,48,22,0,0,32,17,128,0,32,16,224,0,96,16,56,0,96,16,12,0,96,16,3,0,96,16,3,0,96,16,12,0,96,16,56,0,32,16,224,0,32,17,128,0,48,22,0,0,16,28,0,0,24,16,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,3,0,0,0,63,0,0,0,224,0,0,1,128,0,0,3,0,0,0,6,0,0,0,12,0,0,0,0,16,0,0,0,28,0,0,0,22,0,0,0,17,128,0,0,16,224,0,0,16,56,0,0,16,12,0,0,16,3,0,0,16,3,0,0,16,12,0,0,16,56,0,0,16,224,0,0,17,128,0,0,22,0,0,0,28,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,28,0,0,0,22,0,0,0,17,128,0,0,16,224,0,0,16,56,0,0,16,12,0,0,16,3,0,0,16,3,0,0,16,12,0,0,16,56,0,0,16,224,0,0,17,128,0,0,22,0,0,0,28,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,0,0,1,128,0,0,0,192,0,0,0,96,0,0,0,0,0,16,0,0,0,28,0,0,0,22,0,0,0,17,128,0,0,16,224,0,0,16,56,0,0,16,12,0,0,16,3,0,0,16,3,0,0,16,12,0,0,16,56,0,0,16,224,0,0,17,128,0,0,22,0,0,0,28,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,0,0,1,128,0,0,0,192,0,0,0,96,0,0,0,48,0,16,0,24,0,28,0,8,0,22,0,12,0,17,128,4,0,16,224,4,0,16,56,4,0,16,12,6,0,16,3,6,0,16,3,6,0,16,12,6,0,16,56,4,0,16,224,4,0,17,128,4,0,22,0,0,0,28,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,0,0,1,128,0,0,0,192,0,0,0,96,0,0,0,48,0,16,0,24,0,28,0,8,0,22,0,12,0,17,128,4,0,16,224,4,0,16,56,4,0,16,12,6,0,16,3,6,0,16,3,6,0,16,12,4,0,16,56,4,0,16,224,4,0,17,128,4,0,22,0,12,0,28,0,8,0,16,0,24,0,0,0,48,0,0,0,96,0,0,0,192,0,0,1,128,0,0,6,0,0,0,24,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,0,0,1,128,0,0,0,192,0,0,0,96,0,0,0,48,0,16,0,24,0,28,0,8,0,22,0,12,0,17,128,4,0,16,224,4,0,16,56,4,0,16,12,6,0,16,3,6,0,16,3,6,0,16,12,6,0,16,56,4,0,16,224,4,0,17,128,4,0,22,0,12,0,28,0,8,0,16,0,24,0,0,0,48,0,0,0,96,0,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,224,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,0,0,1,128,0,0,0,192,0,0,0,96,0,0,0,48,0,16,0,24,0,28,0,8,0,22,0,12,0,17,128,4,0,16,224,4,0,16,56,4,0,16,12,6,0,16,3,6,0,16,3,6,0,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,224,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,0,0,1,128,0,0,0,192,0,0,0,96,0,0,0,48,0,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,96,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,0,252,0,0,0,7,0,1,0,1,128,3,0,0,192,4,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,0,224,0,0,56,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,32,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,3,224,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,4,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,7,224,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0},
  {0,0,0,0,0,3,192,0,0,63,252,0,0,224,7,0,1,128,1,128,3,0,0,192,6,0,0,96,12,0,0,48,24,16,0,24,16,28,0,8,48,22,0,12,32,17,128,4,32,16,224,4,32,16,56,4,96,16,12,6,96,16,3,6,96,16,3,6,96,16,12,6,32,16,56,4,32,16,224,4,32,17,128,4,48,22,0,12,16,28,0,8,24,16,0,24,12,0,0,48,6,0,0,96,3,0,0,192,1,128,1,128,0,224,7,0,0,63,252,0,0,3,192,0,0,0,0,0}
};

const byte PROGMEM stop[][128] = {
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,128,0,0,3,96,0,0,3,56,0,0,3,12,0,0,3,7,0,0,3,1,128,0,3,0,96,0,3,0,56,0,3,0,12,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,112,3,0,1,192,3,0,7,0,3,0,28,0,3,0,112,0,3,1,192,0,3,7,0,0,3,28,0,0,3,112,0,0,3,192,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,128,0,0,2,96,0,0,2,56,0,0,2,14,0,0,2,3,0,0,2,1,192,0,2,0,112,0,2,0,24,0,2,0,14,0,2,0,3,128,2,0,0,192,2,0,0,96,2,0,0,32,2,0,0,224,2,0,3,0,2,0,28,0,2,0,112,0,2,1,192,0,2,7,0,0,2,28,0,0,2,112,0,0,3,192,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,128,0,0,2,96,0,0,2,24,0,0,2,6,0,0,2,1,128,0,2,0,112,0,2,0,28,0,2,0,7,0,2,0,1,192,2,0,0,64,2,0,0,64,2,0,0,96,2,0,0,32,2,0,0,32,2,0,0,224,2,0,7,128,2,0,28,0,2,0,240,0,2,3,128,0,2,30,0,0,2,112,0,0,3,192,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,128,0,0,2,240,0,0,2,30,0,0,2,3,192,0,2,0,112,0,2,0,30,0,2,0,3,192,2,0,0,64,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,96,2,0,3,192,2,0,30,0,2,1,240,0,2,15,128,0,2,120,0,0,3,192,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,192,0,0,2,252,0,0,2,7,192,0,2,0,126,0,2,0,7,224,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,224,2,0,31,192,2,3,248,0,2,127,0,0,3,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,6,127,240,0,6,0,127,224,6,0,0,96,6,0,0,96,6,0,0,96,6,0,0,96,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,31,224,6,127,252,0,7,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,240,0,4,31,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,15,255,224,7,255,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,7,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,255,240,0,4,31,255,224,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,0,0,32,4,15,255,224,7,255,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,224,0,0,6,127,240,0,6,0,127,224,6,0,0,96,6,0,0,96,6,0,0,96,6,0,0,96,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,0,32,6,0,31,224,6,127,252,0,7,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,192,0,0,2,252,0,0,2,7,192,0,2,0,126,0,2,0,7,224,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,224,2,0,31,192,2,3,248,0,2,127,0,0,3,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,128,0,0,2,240,0,0,2,30,0,0,2,3,192,0,2,0,112,0,2,0,30,0,2,0,3,192,2,0,0,64,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,96,2,0,0,32,2,0,0,32,2,0,0,32,2,0,0,96,2,0,3,192,2,0,30,0,2,1,240,0,2,15,128,0,2,120,0,0,3,192,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,128,0,0,2,96,0,0,2,24,0,0,2,6,0,0,2,1,128,0,2,0,112,0,2,0,28,0,2,0,7,0,2,0,1,192,2,0,0,64,2,0,0,64,2,0,0,96,2,0,0,32,2,0,0,32,2,0,0,224,2,0,7,128,2,0,28,0,2,0,240,0,2,3,128,0,2,30,0,0,2,112,0,0,3,192,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,128,0,0,2,96,0,0,2,56,0,0,2,14,0,0,2,3,0,0,2,1,192,0,2,0,112,0,2,0,24,0,2,0,14,0,2,0,3,128,2,0,0,192,2,0,0,96,2,0,0,32,2,0,0,224,2,0,3,0,2,0,28,0,2,0,112,0,2,1,192,0,2,7,0,0,2,28,0,0,2,112,0,0,3,192,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,128,0,0,3,96,0,0,3,56,0,0,3,12,0,0,3,7,0,0,3,1,128,0,3,0,96,0,3,0,56,0,3,0,12,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,112,3,0,1,192,3,0,7,0,3,0,28,0,3,0,112,0,3,1,192,0,3,7,0,0,3,28,0,0,3,112,0,0,3,192,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,192,0,0,3,112,0,0,3,24,0,0,3,6,0,0,3,3,128,0,3,0,224,0,3,0,48,0,3,0,28,0,3,0,7,0,3,0,1,128,3,0,0,96,3,0,0,96,3,0,1,128,3,0,7,0,3,0,28,0,3,0,48,0,3,0,224,0,3,3,128,0,3,6,0,0,3,24,0,0,3,112,0,0,3,192,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};

const unsigned char startScreen [] 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x03, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x1f, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0xff, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0f, 0xff, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x7f, 0xfe, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0x87, 0xff, 0xe0, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfe, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xe0, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0xff, 0x9c, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0f, 0xfe, 0x0e, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7f, 0xe3, 0x06, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0xff, 0x03, 0x83, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0f, 0xf8, 0x03, 0xc1, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x7f, 0xc0, 0x03, 0xe1, 0x80, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0xfe, 0x00, 0x03, 0xf1, 0x80, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0f, 0xf0, 0x00, 0x03, 0xf8, 0x80, 0x3f, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x3f, 0xc0, 0x00, 0x02, 0x7c, 0x87, 0xff, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0xfe, 0x00, 0x00, 0x02, 0x0e, 0xff, 0xff, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0xf0, 0x00, 0x00, 0x03, 0x0f, 0xff, 0xff, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3f, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xe0, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xfe, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xf8, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x40, 0x00, 0xff, 0xfe, 0xc0, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xc0, 0x00, 0x60, 0x0f, 0xff, 0xe0, 0x40, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x60, 0x7f, 0xfd, 0x00, 0x40, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x67, 0xff, 0xc1, 0x00, 0x60, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x7f, 0xfc, 0x01, 0x00, 0x60, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x08, 0x00, 0x01, 0xff, 0xc0, 0x01, 0x00, 0x20, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf8, 0x08, 0x00, 0x0f, 0xfc, 0x00, 0x01, 0x80, 0x20, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x08, 0x00, 0x7f, 0xf0, 0x00, 0x01, 0x80, 0x40, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x08, 0x03, 0xff, 0x20, 0x00, 0x01, 0x80, 0x40, 0x00, 
	0x00, 0x00, 0x1c, 0x00, 0x01, 0xf8, 0x00, 0x08, 0x1f, 0xf0, 0x30, 0x00, 0x00, 0x80, 0x40, 0x00, 
	0x00, 0x00, 0xfc, 0x00, 0x0f, 0xe0, 0x00, 0x08, 0xff, 0x80, 0x30, 0x00, 0x00, 0x80, 0x40, 0x00, 
	0x00, 0x07, 0xfc, 0x00, 0x3f, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x30, 0x00, 0x3f, 0x80, 0x4f, 0xff, 
	0x00, 0x3f, 0xfc, 0x01, 0xf8, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x10, 0x00, 0x7f, 0x9f, 0xff, 0xff, 
	0x01, 0xff, 0xe4, 0x0f, 0xe0, 0x00, 0x01, 0xff, 0x00, 0x00, 0x10, 0x00, 0xff, 0xff, 0xff, 0xff, 
	0x07, 0xff, 0x84, 0x7f, 0x00, 0x00, 0x07, 0xf8, 0x00, 0x00, 0x13, 0x81, 0xff, 0xff, 0xff, 0xff, 
	0x3f, 0xfc, 0x07, 0xf8, 0x00, 0x00, 0x7f, 0xc8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x00, 
	0x7f, 0xe0, 0x0f, 0xc0, 0x00, 0x01, 0xfe, 0x08, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xe0, 0x00, 0x00, 
	0x7f, 0x00, 0x7e, 0x00, 0x00, 0x0f, 0xf0, 0x08, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x00, 
	0x78, 0x07, 0xf6, 0x00, 0x00, 0x7f, 0x00, 0x08, 0x00, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 
	0x40, 0x3f, 0x86, 0x00, 0x03, 0xf8, 0x00, 0x08, 0x00, 0x7f, 0xff, 0xc3, 0xfe, 0x00, 0x00, 0x00, 
	0x43, 0xf8, 0x02, 0x00, 0x3f, 0xc0, 0x03, 0xe8, 0x07, 0xff, 0xc8, 0xc3, 0xfc, 0x00, 0x00, 0x00, 
	0x7f, 0xc0, 0x02, 0x01, 0xfe, 0x00, 0x0f, 0xf8, 0x3f, 0xfc, 0x09, 0x81, 0xf8, 0x00, 0x00, 0x00, 
	0xfc, 0x00, 0x02, 0x0f, 0xf0, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0x09, 0x00, 0x40, 0x00, 0x00, 0x00, 
	0xc0, 0x00, 0x02, 0x7f, 0x00, 0x00, 0x3f, 0xff, 0xfc, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x40, 0x00, 0x07, 0xf8, 0x00, 0x00, 0x7f, 0xff, 0xc0, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x40, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x7f, 0xfc, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x60, 0x03, 0xfe, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x60, 0x3f, 0xc2, 0x00, 0x00, 0x0f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x27, 0xfc, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xfc, 
	0xff, 0x80, 0x03, 0x00, 0x07, 0xfc, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 
	0xf8, 0x00, 0x03, 0x00, 0x7f, 0xe0, 0xff, 0xc0, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0x20, 0x00, 0x03, 0x07, 0xfc, 0x00, 0x7f, 0x80, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0x20, 0x00, 0x01, 0x7f, 0xc0, 0x00, 0x3e, 0x00, 0x01, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x0f, 0xff, 
	0x20, 0x00, 0x0f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x20, 0x01, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x20, 0x3f, 0xf9, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x3f, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

char * arrayURL[9] = {
  "http://5.63.151.52:7103/stream/1/",
  "http://stream.governamerica.com:4030/index.html/128k.mp3%3Ftype=http&nocache=46079",
  "http://kvbstreams.dyndns.org:8000/wkvi-am",
  "http://mp3.ffh.de/radioffh/hqlivestream.mp3",
  "http://hoth.alonhosting.com:1100/stream/1/",
  "http://radio.punjabrocks.com:9998/stream/1/",
  "http://server.mixify.in:8000/stream/1/",
  "http://142.4.219.8:8255/stream/1/",
  "http://mehefil.no-ip.com/stream/1/"
};

String arrayStation[9] = {
  "A",
  "B",
  "C",
  "D",
  "BollyHits Radio",
  "Taal Radio",
  "Mixify",
  "Bollywood Gold",
  "Mehefil Radio"
};

const int BTNA = 4;   // Play / Pause
const int BTNB = 16;  // Station Select / Volume

AudioGeneratorTalkie *talkie;          
AudioGeneratorMP3 *mp3;
AudioFileSourceICYStream *file;
AudioFileSourceBuffer *buff;
AudioOutputI2S *out;
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

const int numCh = sizeof(arrayURL)/sizeof(char *);
bool TestMode = false;
uint32_t LastTime = 0;
int playflag = 0;
int ledflag = 0;
float fgain = 10.0;
int sflag = 0;
char *URL = arrayURL[sflag]; 
String station = arrayStation[sflag];

byte b=2;
bool inv=0;
       
void setup() {
  Serial.begin(115200);
  pinMode(BTNA, INPUT_PULLUP);
  pinMode(BTNB, INPUT_PULLUP);
  if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F("SSD1306 allocation failed"));
  }
  initwifi();
  display.clearDisplay();
  display.drawBitmap(0,0,startScreen,128,64,WHITE);
  display.display();
  delay(1000);
  Serial.printf("STATUS(System) Ready \n\n");
  out = new AudioOutputI2S(); // Output to externalDAC
  out->SetPinout(33, 14, 25); // (int bclk, int lrc, int dout)
  out->SetOutputModeMono(true);
  out->SetGain(fgain*0.05);
}

float n=0;
int frame;

void loop() {
  static int lastms = 0;
  if (playflag == 0) {
    if (digitalRead(BTNA) ==  LOW) {
      StartPlaying();
      playflag = 1;
    }
    if (digitalRead(BTNB) ==  LOW) {
      sflag = (sflag + 1) % numCh;
      URL = arrayURL[sflag];
      station = arrayStation[sflag];  
      Serial.println(station);
      display.clearDisplay();
      display.setTextSize(1);      // Normal 1:1 pixel scale
      display.setTextColor(SSD1306_WHITE); // Draw white text
      display.setCursor(0, 20);
      display.println(station);
      display.display();             
      delay(300);
    }
  }
  if (playflag == 1) {
    if (mp3->isRunning()) {
      if (millis() - lastms > 1000) {
        lastms = millis();
        Serial.printf("STATUS(Streaming) %d ms...\n", lastms);
      }
      if (!mp3->loop()) mp3->stop();
    } else {
      Serial.printf("MP3 done\n");
      playflag = 0; 
    }
    if (digitalRead(BTNA) ==  LOW) {
      StopPlaying();
      display.clearDisplay();
      display.drawBitmap(0,0,startScreen,128,64,WHITE);
      display.display();
      playflag = 0;
      delay(200);
    }
    if (digitalRead(BTNB) ==  LOW) {
      fgain = fgain + 1.0;
      if (fgain > 10.0) {
        fgain = 1.0;
      }
      out->SetGain(fgain*0.05);
      Serial.printf("STATUS(Gain) %f \n", fgain*0.05);
      delay(200);
    }
  }
}

void StartPlaying() {
  frame = 0;
  while(frame < 27){
    display.clearDisplay();
    display.drawBitmap(48, 16, play[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
    display.display();
    frame = (frame + 1) % FRAME_COUNT;
    Serial.println(frame);
    delay(FRAME_DELAY);
  }
  file = new AudioFileSourceICYStream(URL);
  file->RegisterMetadataCB(MDCallback, (void*)"ICY");
  buff = new AudioFileSourceBuffer(file, bufferSize);
  buff->RegisterStatusCB(StatusCallback, (void*)"buffer");
  out = new AudioOutputI2S(); //
  out->SetPinout(33, 14, 25); // (int bclk, int lrc, int dout)
  out->SetOutputModeMono(true);
  out->SetGain(fgain*0.05);
  mp3 = new AudioGeneratorMP3();
  mp3->RegisterStatusCB(StatusCallback, (void*)"mp3");
  mp3->begin(buff, out);
  Serial.printf("STATUS(URL) %s \n", URL);
  Serial.flush();
}

void StopPlaying() {
  frame = 0;
  while(frame < 27){
    display.clearDisplay();
    display.drawBitmap(48, 16, stop[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
    display.display();
    frame = (frame + 1) % FRAME_COUNT;
    Serial.println(frame);
    delay(FRAME_DELAY);
  }
  if (mp3) {
    mp3->stop();
    delete mp3;
    mp3 = NULL;
  }
  if (buff) {
    buff->close();
    delete buff;
    buff = NULL;
  }
  if (file) {
    file->close();
    delete file;
    file = NULL;
  }
  Serial.printf("STATUS(Stopped)\n");
  Serial.flush();
}

void initwifi() {
  frame = 0;
  WiFi.disconnect();
  WiFi.softAPdisconnect(true);
  WiFi.mode(WIFI_STA);
  WiFi.begin(SSID, PASSWORD);

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) {
    //Serial.println("STATUS(Connecting to WiFi) ");
    //delay(500);
    display.clearDisplay();
    display.drawBitmap(48, 16, wifi[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
    display.display();
    frame = (frame + 1) % FRAME_COUNT;
    delay(FRAME_DELAY);
  }
  Serial.println("OK");
}

void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string) {
  const char *ptr = reinterpret_cast<const char *>(cbData);
  (void) isUnicode; // Punt this ball for now
  // Note that the type and string may be in PROGMEM, so copy them to RAM for printf
  char s1[32], s2[64];
  strncpy_P(s1, type, sizeof(s1));
  s1[sizeof(s1) - 1] = 0;
  strncpy_P(s2, string, sizeof(s2));
  s2[sizeof(s2) - 1] = 0;
  display.clearDisplay();
  display.setTextSize(1);      // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE); // Draw white text
  display.setCursor(0, 0);
  display.println(station);
  display.drawFastHLine(0, 10, 128, WHITE);
  display.setCursor(0, 20);
  display.println(s2);
  display.display();
  Serial.printf("METADATA(%s) '%s' = '%s'\n", ptr, s1, s2);                                                                      
  Serial.flush();
}

void StatusCallback(void *cbData, int code, const char *string) {
  const char *ptr = reinterpret_cast<const char *>(cbData);
  // Note that the string may be in PROGMEM, so copy it to RAM for printf
  char s1[64];
  strncpy_P(s1, string, sizeof(s1));
  s1[sizeof(s1) - 1] = 0;
  Serial.printf("STATUS(%s) '%d' = '%s'\n", ptr, code, s1);
  Serial.flush();
}

Credits

Neeraj Rane

Neeraj Rane

18 projects • 47 followers
Electrical Engineer and a Maker from India. Engineering is fun once you start applying it!

Comments