#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define bt1 19
bool pause_flg = 1;
byte bt1_flg = 0;
String station = "Radio Cidade";
String title = "Titas-Lugar Nenhum";
String ip = "192.168.1.95";
Adafruit_SSD1306 oled(128, 64, &Wire);
void setup() {
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.clearDisplay();
pinMode(bt1, INPUT_PULLUP);
layout();
}
void loop() {
if (!digitalRead(bt1))
bt1_flg = 1;
if (digitalRead(bt1) && bt1_flg)
{
bt1_flg = 0;
pause_flg = !pause_flg;
layout();
}
}
void layout() {
oled.fillRect(0, 0, 127, 11, SSD1306_WHITE); // (x, y, lagura, altura)
oled.drawLine(0, 50, 127, 50, SSD1306_WHITE);
oled.drawLine(0, 30, 127, 30, SSD1306_WHITE);
oled.drawLine(85, 50, 85, 63, SSD1306_WHITE);
oled.drawLine(0, 63, 127, 63, SSD1306_WHITE);
oled.setTextSize(1);
oled.setTextColor(0);
oled.setCursor(35, 2);
oled.print("Web Radio");
oled.setTextColor(1);
oled.setCursor(5, 20);
oled.print(station);
oled.setCursor(5, 40);
oled.print(title);
oled.setCursor(5, 54);
oled.print(ip);
s_play();
oled.display();
}
void s_play()
{
if (pause_flg == 1)
{
oled.fillRect(100, 54, 6, 7, SSD1306_BLACK);// (x,y,largura, altura,cor)
oled.setTextColor(SSD1306_WHITE);
oled.setCursor(90, 54);
oled.write(16);
}
else
{
oled.fillRect(90, 54, 6, 7, SSD1306_BLACK);
oled.fillRect(100, 54, 6, 7, SSD1306_WHITE);// (x,y,largura, altura,cor)
}
}