Retro Internet Radio using ESP32 & Transparent OLED Display

0 835 Medium

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

 

Retro Internet Radio using ESP32 & Transparent OLED Display
HARDWARE LIST
1 DFRobot Fermion: 1.51” OLED Transparent Display with Converter (Breakout)
1 Espressif ESP32S

Software apps and online services

· Arduino IDE

· Autodesk Fusion 360: https://www.hackster.io/autodesk/products/fusion-360?ref=project-c36146

· PCBWay

 

Hand tools and fabrication machines

· 3D Printer (generic)

 

Several years ago, I crafted an FM radio using the compact RDA5807M module, a tuner that delivered FM radio in a small package. While it functioned well and brought enjoyment to the entire family, the reception was subpar. I resorted to hanging a lengthy wire down my window to enhance reception just to get a usable audio on few of the stations.

Now, I've opted to construct another radio, but this time, it will be an internet radio instead of an FM one. It can be kept anywhere in the house without the need of an antennae. As far as it has good Wi-Fi reception, it should work fine. Also, there a lot of internet streaming stations which we can listen to and not just the regular stations.

 

Supplies

Major components

1x ESP-32

1x 1.51" Transparent OLED display

1x MAX98357 I2S 3W Class D Amplifier

1x Micro USB Type B Connectors

1x Tiny loudspeaker (I salvaged mine from an old phone)

1x DC-DC Charge Discharge Integrated Module 5V/2A

1x 120mAH Li-Po Battery

1x SPDT slide switch

1x 24-pin 0.5mm FPC connector

4x M3 x 4mm Threaded Round Inserts

and electronic components as per schematics

 

The Plan

 

 

The plan is to use ESP-32 as the brains of this internet radio. The ESP-32 will establish connections with streaming services on the internet to retrieve audio content. Using the ESP-32's in-built DAC and I2S protocol, the audio would be played on a tiny loud speaker which I salvaged from an old mobile phone via the MAX98357 amplifier.

I will be designing a custom PCB to reduce the overall size and to keep the electronics neat and clean. The design will mimic a cassette, adding a touch of retro aesthetics.

DFRobot was kind enough to provide a 1.51" Transparent OLED display, which I plan to incorporate into the project. Positioned at the center of the cassette, it could showcase audio data or even feature dynamic animations, contributing to the overall appeal of the device. Let's explore the possibilities and see how it enhances the final product!

 

Radio Stations

 

 

 

 

I would say that the trickiest part of this project is to find links to the streaming service that would work for the ESP32. I will be showing how you can get working links from internet-radio.com, a website I found with lots of internet radios from across the globe. The process would be more or less similar for other websites.

Open up the website and select a station of your choice. We now need to look for the source from where the audio is being streamed.

Right-click anywhere and select "inspect" or "view page source".

Look for the words 'live', 'stream', 'mp3', etc and you will most probably see a streaming link somewhere near. To test it, open the link in the browser. If you see a screen as shown in the photo with audio playing in the background, that should be it.

Gather all the links to your favorite stations along with their names. These need to be fed later before uploading the code.

 

3D Design

 

 

As discussed earlier, the radio would be in the shape of a cassette. The radio would consist of the following parts -

Front PCB - This PCB only contains art to add some visual appeal.Back PCB - This PCB holds all the electronicsFrame - to hold both the PCBs togetherBattery compartment & lidFront & Back Spacers to close the gap between PCBs and display 

PCB Design

 

 

I first started prototyping on a breadboard to interface ESP32 with the transparent display and amplifier modules and to make sure everything worked as planned—electronics inspired from the Internet Radio project by Volos Projects.

Only two push buttons change the stations, start/stop the music stream, and adjust the volume. This helps in keeping the design simple and minimal.

CH340 is used to program the ESP32 module using a USB port.

All this would be powered by a lithium-ion battery along with an overcurrent/overcharge protection circuit.

To reduce the overall size of the radio, I decided to combine all the modules on a single PCB.

The speaker needed to be small as well with some decent audio output level. The mobile phone speaker is perfect for this job and I salvaged mine from an old Micromax mobile phone.

Once the electronics were finalized, I started designing the PCB using EasyEDA. I created the outline of the cassette in Fusion360 & exported the sketch as a DXF file. I then imported the DXF into EasyEDA to define the outline of the board. All the components were adjusted to fit the shape of the board.

Schematics are attached in this step. Click here to download the Gerber files.

 

Assembly

 

 

 

 

 

After receiving the PCBs from PCBWay, it was time to put everything together. I utilized a stencil, also obtained from PCBWay, to apply solder paste and proceeded to solder all the components onto the PCB. During the time of making this project, I could not find a 24-pin FPC connector for the OLED display and I had to desolder it from the breakout board which got damaged due to excess heat but was still functional.

Once the PCB was assembled, I 3D printed the frame, battery compartment, and lid using white PLA filament. The battery compartment needs to be glued to the frame.

Place the battery in the compartment, thread its wire through the provided holes, and connect them to the charging module. Make the 5V IN & 5V OUT connections between the module and the PCB.

Glue the front and back spacers to the edge of the display cutout.

Place the OLED display and carefully connect its flat cable to the FPC connector on the PCB.

Place the thread inserts in their slots and screw in the front and back PCBs using M3 screws.

 

Code

 

 

 

Connect the PCB to your PC using a micro USB cable. If everything goes well, your PC should recognize the CH340 chip. Download the attached file and open it using Arduino IDE.

Before you upload, make the following changes:

· Enter your WiFi SSID & password· Edit arrayURL with the streaming links of the radio stations of your choice· Edit arrayStation with the name of the radio stations 

Enjoy!

 

 

 

Turn ON the radio and enjoy the station of your choice! There is a lot of scope for improvement or many features that can be added to the radio. For example, an audio spectrum analyzer on the display that reacts to the music being played. That would be cool to watch! Maybe a v2.0 in the future? But that's it for now.

Hope you all enjoyed this project. Give a like if you did and subscribe for more such projects. See you in the next one.

 

Custom parts and enclosures

· Back Spacer

· Battery Compartment

· Front Spacer

· Frame

· Lid

 

Schematics

 

Code

CODE
#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();
}
License
All Rights
Reserved
licensBg
0