Programm mit zwei Tastern
#include "Arduino.h"
#include "WiFi.h"
#include "VS1053.h"
#include "ESP32_VS1053_Stream.h"
#include "LCDIC2.h"
// 4-zeiliges LCD
LCDIC2 lcd(0x27, 20, 4);
#include "OneButton.h"
#define VS1053_CS 5
#define VS1053_DCS 16
#define VS1053_DREQ 4
// Pins Taster
int TasterLautstaerke = 12;
int TasterSender = 14;
OneButton SenderWahl(TasterSender, true);
OneButton LautstaerkeEinstellen(TasterLautstaerke, true);
// Variablen Sender
int SenderIndex = 0;
int AnzahlSender = 0;
int Lautstaerke = 80;
int GesicherteLautstaerke = Lautstaerke;
ESP32_VS1053_Stream stream;
// WiFi-Daten
char Router[] = "Router_SSID";
char Passwort[] = "xxxxxxxx";
const char* Sender[] =
{
"http://wdr-1live-live.icecast.wdr.de/wdr/1live/live/mp3/128/stream.mp3", // 1Live
"http://wdr-wdr2-bergischesland.icecast.wdr.de/wdr/wdr2/bergischesland/mp3/128/stream.mp3", // WDR2
"http://wdr-wdr4-live.icecast.wdr.de/wdr/wdr4/live/mp3/128/stream.mp3", // WDR4
"http://liveradio.swr.de/sw282p3/swr3/play.mp3", // SWR3
"http://dispatcher.rndfnk.com/swr/swr4/ko/mp3/128/stream.mp3", // SWR4
"http://avw.mdr.de/streams/284321-1_mp3_high.m3u", // MDR JUMP Rock channel
"http://dispatcher.rndfnk.com/hr/hr1/rheinmain/high", // HR1
"http://www.ndr.de/resources/metadaten/audio/m3u/ndr2_hh.m3u", // NDR Hamburg
"http://dispatcher.rndfnk.com/rbb/rbb888/live/mp3/mid", // RBB 88,8
"http://liveradio.sr.de/sr/sr3/mp3/128/stream.mp3", // SR 3
"http://icecast.ndr.de/ndr/njoy/live/mp3/128/stream.mp3", // N-Joy
"http://st01.sslstream.dlf.de/dlf/01/128/mp3/stream.mp3?aggregator=web", // Deutschlandfunk
"http://stream.lokalradio.nrw/444z6rq", // Radio Berg
"http://orf-live.ors-shoutcast.at/oe3-q2a", // Ö3
"http://antennebrandenburg.de/livemp3", // Antenne Brandenburg
"http://stream.antenne.de/antenne/stream/mp3", // Antenne Bayern live
"http://stream.antenne.de/antenne-bayern-70er-rock/stream/mp3", // Antenne Bayern 70er Rock
"http://stream.antenne.de/classic-rock-live/stream/mp3", // Antenne Bayern Classic Rock
"http://stream.antenne.de/antenne-bayern-80er-rock/stream/mp3", // Antenne Bayern 80er Rock
"http://classicrock.radioarabella.de/arabella-classicrock.mp3", // Radio Arabella
"http://www.charivari.de/webradio/r8082.m3u", // Radio Charivari München
};
const char *Beschreibung[]
{
"1Live", "WDR 2", "WDR 4", "SWR 3", "SWR 4", "MDR JUMP", "HR 1", "NDR 2", "RBB 88,8",
"SR 3", "N-Joy", "Deutschlandfunk","Radio Berg", "\xEF 3", "Antenne Brandenburg", "Antenne Bayern live",
"Antenme Bayern 70er", "Antenne Bayern Rock", "Antenne Bayern 80er",
"Radio Arabella", "Radio Charivari"
};
void setup()
{
Serial.begin(9600);
// LCD starten
lcd.begin();
// Cursor "verstecken"
lcd.setCursor(false);
/*
Aktionen dem Modus der Tasters zuordnen
setPressTicks(500);
setClickTicks(200);
setDebounceTicks(50);
*/
SenderWahl.attachClick(SenderVor);
SenderWahl.attachDoubleClick(SenderZurueck);
SenderWahl.attachLongPressStop(ErsterSender);
LautstaerkeEinstellen.attachClick(Leiser);
LautstaerkeEinstellen.attachDoubleClick(Lauter);
LautstaerkeEinstellen.attachLongPressStop(TonAus);
// pinModes definieren
pinMode(TasterSender, INPUT_PULLUP);
pinMode(TasterLautstaerke, INPUT_PULLUP);
// auf Seriellen Monitor warten
while (!Serial)
{
delay(10);
}
// WiFi starten
WiFi.mode(WIFI_STA);
WiFi.begin(Router, Passwort);
Serial.println("------------------------");
while (WiFi.status() != WL_CONNECTED)
{
delay(200);
Serial.print(".");
}
Serial.println();
Serial.print("Verbunden mit ");
Serial.println(WiFi.SSID());
Serial.print("IP über DHCP: ");
Serial.println(WiFi.localIP());
// Start SPI bus
SPI.setHwCs(true);
SPI.begin();
// Decoder starten
if (!stream.startDecoder(VS1053_CS, VS1053_DCS, VS1053_DREQ) || !stream.isChipConnected())
{
Serial.println("Decoder konnte nicht gestartet werden ..");
Serial.println("Programm angehalten!");
while (1);
}
Serial.println("MP3-Decoder gestartet ...");
// Sender verbinden
stream.connecttohost(Sender[SenderIndex]);
// wenn der Stream nicht mehr läuft ...
if (!stream.isRunning())
{
Serial.println("Radio wird neu gestartet ...");
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
Serial.print("Codec: ");
Serial.println(stream.currentCodec());
Serial.print("Bitrate: ");
Serial.print(stream.bitrate());
Serial.println(" kbps");
stream.setVolume(Lautstaerke);
// Anzahl der Sender im Array feststellen
AnzahlSender = sizeof(Sender) / sizeof(Sender[0]);
Serial.println("Anzahl der Sender:" + String(AnzahlSender));
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void loop()
{
SenderWahl.tick();
delay(10);
LautstaerkeEinstellen.tick();
delay(10);
// wenn Stream gestoppt -> neu verbinden
if (!stream.isRunning())
{
// stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
// Stream abspielen
stream.loop();
delay(5);
}
// Sender im Seriellen Monitor anzeigen
void audio_showstation(const char* info)
{
Serial.printf("Station: %s\n", info);
}
// Titel anzeigen
void audio_showstreamtitle(const char* info)
{
String Titel = String(info);
Titel.replace(" - ", " ");
Titel.replace(" / ", " ");
Titel.replace(" von ", " ");
if (Titel.length() > 20) Titel = Titel.substring(0, 20);
lcd.setCursor(0,2);
lcd.print(Titel);
Serial.printf("Titel: %s\n", info);
}
void audio_eof_stream(const char* info)
{
Serial.printf("Ende: %s\n", info);
}
void SenderVor()
{
// wenn der letzte Sender -> zurück auf 0
if (SenderIndex >= AnzahlSender - 1) SenderIndex = 0;
else SenderIndex++;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
// Sender/Lautstärke auf dem LCD anzeigen
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void SenderZurueck()
{
// wenn der letzte Sender -> zurück auf 0
if (SenderIndex == 0) SenderIndex = AnzahlSender - 1;
else SenderIndex--;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
// Sender/Lautstärke auf dem LCD anzeigen
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void Leiser()
{
if (Lautstaerke > 5) Lautstaerke -= 5;
// if (Lautstaerke == 0) Lautstaerke += 5;
GesicherteLautstaerke = Lautstaerke;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void Lauter()
{
if (Lautstaerke < 95) Lautstaerke += 5;
GesicherteLautstaerke = Lautstaerke;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void TonAus()
{
if (Lautstaerke == 0)
{
stream.setVolume(GesicherteLautstaerke);
lcd.setCursor(0, 1);
lcd.print("Ton ein ");
Lautstaerke = GesicherteLautstaerke;
}
else
{
Lautstaerke = 0;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Ton aus ");
}
}
void ErsterSender()
{
SenderIndex = 0;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
// Sender/Lautstärke auf dem LCD anzeigen
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}Programm mit drei Tastern

lauter - leiser - Senderwahl
#include "Arduino.h"
#include "WiFi.h"
#include "VS1053.h"
#include "ESP32_VS1053_Stream.h"
#include "LCDIC2.h"
// 4-zeiliges LCD
LCDIC2 lcd(0x27, 20, 4);
// Bibliothek Bounce einbinden
#include "Bounce2.h"
// Bounce starten
Bounce SenderGedrueckt = Bounce();
Bounce LauterGedrueckt = Bounce();
Bounce LeiserGedrueckt = Bounce();
#define VS1053_CS 5
#define VS1053_DCS 16
#define VS1053_DREQ 4
// Pins Taster
int TasterLeiser = 12;
int TasterLauter = 13;
int TasterSender = 14;
// Variablen Sender
int SenderIndex = 0;
int AnzahlSender = 0;
int Lautstaerke = 80;
ESP32_VS1053_Stream stream;
// WiFi-Daten
char Router[] = "Router_SSID";
char Passwort[] = "xxxxxxxx";
const char* Sender[] =
{
"http://wdr-1live-live.icecast.wdr.de/wdr/1live/live/mp3/128/stream.mp3", // 1Live
"http://wdr-wdr2-bergischesland.icecast.wdr.de/wdr/wdr2/bergischesland/mp3/128/stream.mp3", // WDR2
"http://wdr-wdr4-live.icecast.wdr.de/wdr/wdr4/live/mp3/128/stream.mp3", // WDR4
"http://liveradio.swr.de/sw282p3/swr3/play.mp3", // SWR3
"http://dispatcher.rndfnk.com/swr/swr4/ko/mp3/128/stream.mp3", // SWR4
"http://avw.mdr.de/streams/284321-1_mp3_high.m3u", // MDR JUMP Rock channel
"http://dispatcher.rndfnk.com/hr/hr1/rheinmain/high", // HR1
"http://www.ndr.de/resources/metadaten/audio/m3u/ndr2_hh.m3u", // NDR Hamburg
"http://dispatcher.rndfnk.com/rbb/rbb888/live/mp3/mid", // RBB 88,8
"http://liveradio.sr.de/sr/sr3/mp3/128/stream.mp3", // SR 3
"http://icecast.ndr.de/ndr/njoy/live/mp3/128/stream.mp3", // N-Joy
"http://st01.sslstream.dlf.de/dlf/01/128/mp3/stream.mp3?aggregator=web", // Deutschlandfunk
"http://stream.lokalradio.nrw/444z6rq", // Radio Berg
"http://orf-live.ors-shoutcast.at/oe3-q2a", // Ö3
"http://antennebrandenburg.de/livemp3", // Antenne Brandenburg
"http://stream.antenne.de/antenne/stream/mp3", // Antenne Bayern live
"http://stream.antenne.de/antenne-bayern-70er-rock/stream/mp3", // Antenne Bayern 70er Rock
"http://stream.antenne.de/classic-rock-live/stream/mp3", // Antenne Bayern Classic Rock
"http://stream.antenne.de/antenne-bayern-80er-rock/stream/mp3", // Antenne Bayern 80er Rock
"http://classicrock.radioarabella.de/arabella-classicrock.mp3", // Radio Arabella
"http://www.charivari.de/webradio/r8082.m3u", // Radio Charivari München
};
const char *Beschreibung[]
{
"1Live", "WDR 2", "WDR 4", "SWR 3", "SWR 4", "MDR JUMP", "HR 1", "NDR 2", "RBB 88,8",
"SR 3", "N-Joy", "Deutschlandfunk","Radio Berg", "\xEF 3", "Antenne Brandenburg", "Antenne Bayern live",
"Antenme Bayern 70er", "Antenne Bayern Rock", "Antenne Bayern 80er",
"Radio Arabella", "Radio Charivari"
};
void setup()
{
Serial.begin(9600);
// LCD starten
lcd.begin();
// Cursor "verstecken"
lcd.setCursor(false);
// Bounce den Tastern zuordnen
SenderGedrueckt.attach(TasterSender, INPUT_PULLUP);
SenderGedrueckt.interval(20);
LeiserGedrueckt.attach(TasterLeiser, INPUT_PULLUP);
LeiserGedrueckt.interval(20);
LauterGedrueckt.attach(TasterLauter, INPUT_PULLUP);
LauterGedrueckt.interval(20);
// pinModes definieren
pinMode(TasterSender, INPUT_PULLUP);
pinMode(TasterLeiser, INPUT_PULLUP);
pinMode(TasterLauter, INPUT_PULLUP);
// auf Seriellen Monitor warten
while (!Serial)
{
delay(10);
}
// WiFi starten
WiFi.mode(WIFI_STA);
WiFi.begin(Router, Passwort);
Serial.println("------------------------");
while (WiFi.status() != WL_CONNECTED)
{
delay(200);
Serial.print(".");
}
Serial.println();
Serial.print("Verbunden mit ");
Serial.println(WiFi.SSID());
Serial.print("IP über DHCP: ");
Serial.println(WiFi.localIP());
// Start SPI bus
SPI.setHwCs(true);
SPI.begin();
// Decoder starten
if (!stream.startDecoder(VS1053_CS, VS1053_DCS, VS1053_DREQ) || !stream.isChipConnected())
{
Serial.println("Decoder konnte nicht gestartet werden ..");
Serial.println("Programm angehalten!");
while (1);
}
Serial.println("MP3-Decoder gestartet ...");
// Sender verbinden
stream.connecttohost(Sender[SenderIndex]);
// wenn der Stream nicht mehr läuft ...
if (!stream.isRunning())
{
Serial.println("Radio wird neu gestartet ...");
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
Serial.print("Codec: ");
Serial.println(stream.currentCodec());
Serial.print("Bitrate: ");
Serial.print(stream.bitrate());
Serial.println(" kbps");
stream.setVolume(Lautstaerke);
// Anzahl der Sender feststellen und anzeigen
AnzahlSender = sizeof(Sender) / sizeof(Sender[0]);
Serial.println("Anzahl der Sender: " + String(AnzahlSender));
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void loop()
{
// Taster abfragen
if (LeiserGedrueckt.update())
{
if (LeiserGedrueckt.fell())
{
if (Lautstaerke > 5) Lautstaerke -= 5;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
}
if (LauterGedrueckt.update())
{
if (LauterGedrueckt.fell())
{
if (Lautstaerke < 95) Lautstaerke += 5;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
}
if (SenderGedrueckt.update())
{
if (SenderGedrueckt.fell())
{
if (SenderIndex > 3) SenderIndex = 0;
else SenderIndex++;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
if (!stream.isRunning())
{
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
// Codec/bitrate anzeigen
Serial.print("Codec: ");
Serial.println(stream.currentCodec());
Serial.print("Bitrate: ");
Serial.print(stream.bitrate());
Serial.println(" kbps");
}
// wenn Stream gestoppt -> neu verbinden
if (!stream.isRunning())
{
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
// Stream abspielen
stream.loop();
delay(5);
}
void audio_showstation(const char* info)
{
Serial.printf("Station: %s\n", info);
}
void audio_showstreamtitle(const char* info)
{
Serial.printf("Stream title: %s\n", info);
}
void audio_eof_stream(const char* info)
{
Serial.printf("End of stream: %s\n", info);
}Programm mit Fernbedienung
#include "Arduino.h"
#include "WiFi.h"
#include "VS1053.h"
#include "ESP32_VS1053_Stream.h"
#include "LCDIC2.h"
#include "IRremote.hpp"
int EmpfaengerPin = 13;
// 4-zeiliges LCD
LCDIC2 lcd(0x27, 20, 4);
// Pins des VS1053
#define VS1053_CS 5
#define VS1053_DCS 16
#define VS1053_DREQ 4
// Variablen Sender
int SenderIndex = 0;
int AnzahlSender = 0;
int Lautstaerke = 80;
int GesicherteLautstaerke = Lautstaerke;
ESP32_VS1053_Stream stream;
// WiFi-Daten
char Router[] = "Router_SSID";
char Passwort[] = "xxxxxxxx";
const char* Sender[] =
{
"http://wdr-1live-live.icecast.wdr.de/wdr/1live/live/mp3/128/stream.mp3", // 1Live
"http://wdr-wdr2-bergischesland.icecast.wdr.de/wdr/wdr2/bergischesland/mp3/128/stream.mp3", // WDR2
"http://wdr-wdr4-live.icecast.wdr.de/wdr/wdr4/live/mp3/128/stream.mp3", // WDR4
"http://liveradio.swr.de/sw282p3/swr3/play.mp3", // SWR3
"http://dispatcher.rndfnk.com/swr/swr4/ko/mp3/128/stream.mp3", // SWR4
"http://avw.mdr.de/streams/284321-1_mp3_high.m3u", // MDR JUMP Rock channel
"http://dispatcher.rndfnk.com/hr/hr1/rheinmain/high", // HR1
"http://www.ndr.de/resources/metadaten/audio/m3u/ndr2_hh.m3u", // NDR Hamburg
"http://dispatcher.rndfnk.com/rbb/rbb888/live/mp3/mid", // RBB 88,8
"http://liveradio.sr.de/sr/sr3/mp3/128/stream.mp3", // SR 3
"http://icecast.ndr.de/ndr/njoy/live/mp3/128/stream.mp3", // N-Joy
"http://st01.sslstream.dlf.de/dlf/01/128/mp3/stream.mp3?aggregator=web", // Deutschlandfunk
"http://stream.lokalradio.nrw/444z6rq", // Radio Berg
"http://orf-live.ors-shoutcast.at/oe3-q2a", // Ö3
"http://antennebrandenburg.de/livemp3", // Antenne Brandenburg
"http://stream.antenne.de/antenne/stream/mp3", // Antenne Bayern live
"http://stream.antenne.de/antenne-bayern-70er-rock/stream/mp3", // Antenne Bayern 70er Rock
"http://stream.antenne.de/classic-rock-live/stream/mp3", // Antenne Bayern Classic Rock
"http://stream.antenne.de/antenne-bayern-80er-rock/stream/mp3", // Antenne Bayern 80er Rock
"http://classicrock.radioarabella.de/arabella-classicrock.mp3", // Radio Arabella
"http://www.charivari.de/webradio/r8082.m3u", // Radio Charivari München
};
const char *Beschreibung[]
{
"1Live", "WDR 2", "WDR 4", "SWR 3", "SWR 4", "MDR JUMP", "HR 1", "NDR 2", "RBB 88,8",
"SR 3", "N-Joy", "Deutschlandfunk","Radio Berg", "\xEF 3", "Antenne Brandenburg", "Antenne Bayern live",
"Antenme Bayern 70er", "Antenne Bayern Rock", "Antenne Bayern 80er",
"Radio Arabella", "Radio Charivari"
};
void setup()
{
Serial.begin(9600);
// LCD starten
lcd.begin();
// Cursor "verstecken"
lcd.setCursor(false);
// Infrarot-Empfänger starten
IrReceiver.begin(EmpfaengerPin);
// auf Seriellen Monitor warten
while (!Serial)
{
delay(10);
}
// WiFi starten
WiFi.mode(WIFI_STA);
WiFi.begin(Router, Passwort);
Serial.println("------------------------");
while (WiFi.status() != WL_CONNECTED)
{
delay(200);
Serial.print(".");
}
Serial.println();
Serial.print("Verbunden mit ");
Serial.println(WiFi.SSID());
Serial.print("IP über DHCP: ");
Serial.println(WiFi.localIP());
// Start SPI bus
SPI.setHwCs(true);
SPI.begin();
// Decoder starten
if (!stream.startDecoder(VS1053_CS, VS1053_DCS, VS1053_DREQ) || !stream.isChipConnected())
{
Serial.println("Decoder konnte nicht gestartet werden ..");
Serial.println("Programm angehalten!");
while (1);
}
Serial.println("MP3-Decoder gestartet ...");
// Sender verbinden
stream.connecttohost(Sender[SenderIndex]);
// wenn der Stream nicht mehr läuft ...
if (!stream.isRunning())
{
Serial.println("Radio wird neu gestartet ...");
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
Serial.print("Codec: ");
Serial.println(stream.currentCodec());
Serial.print("Bitrate: ");
Serial.print(stream.bitrate());
Serial.println(" kbps");
stream.setVolume(Lautstaerke);
// Anzahl der Sender im Array feststellen
AnzahlSender = sizeof(Sender) / sizeof(Sender[0]);
Serial.println("Anzahl der Sender:" + String(AnzahlSender));
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void loop()
{
// decode() -> Daten lesen
if (IrReceiver.decode())
{
// kurzes delay, damit nur ein Tastendruck gelesen wird
delay(200);
// resume -> nächsten Wert lesen
IrReceiver.resume();
if (IrReceiver.decodedIRData.command > 0 && IrReceiver.decodedIRData.command < 95)
{
// Werte abfragen
if (IrReceiver.decodedIRData.command == 22) ErsterSender();
if (IrReceiver.decodedIRData.command == 74) TonAus();
if (IrReceiver.decodedIRData.command == 68) SenderZurueck();
if (IrReceiver.decodedIRData.command == 67) SenderVor();
if (IrReceiver.decodedIRData.command == 70) Lauter();
if (IrReceiver.decodedIRData.command == 21) Leiser();
if (IrReceiver.decodedIRData.command == 64) Serial.println("OK");
}
}
// wenn Stream gestoppt -> neu verbinden
if (!stream.isRunning())
{
// stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
}
// Stream abspielen
stream.loop();
delay(5);
}
// Sender im Seriellen Monitor anzeigen
void audio_showstation(const char* info)
{
Serial.printf("Station: %s\n", info);
}
// Titel anzeigen
void audio_showstreamtitle(const char* info)
{
String Titel = String(info);
Titel.replace(" - ", " ");
Titel.replace(" / ", " ");
Titel.replace(" von ", " ");
if (Titel.length() > 20) Titel = Titel.substring(0, 20);
lcd.setCursor(0,2);
lcd.print(Titel);
Serial.printf("Titel: %s\n", info);
}
void audio_eof_stream(const char* info)
{
Serial.printf("Ende: %s\n", info);
}
void SenderVor()
{
// wenn der letzte Sender -> zurück auf 0
if (SenderIndex >= AnzahlSender - 1) SenderIndex = 0;
else SenderIndex++;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
// Sender/Lautstärke auf dem LCD anzeigen
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void SenderZurueck()
{
// wenn der letzte Sender -> zurück auf 0
if (SenderIndex == 0) SenderIndex = AnzahlSender - 1;
else SenderIndex--;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
// Sender/Lautstärke auf dem LCD anzeigen
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void Leiser()
{
if (Lautstaerke > 5) Lautstaerke -= 5;
// if (Lautstaerke == 0) Lautstaerke += 5;
GesicherteLautstaerke = Lautstaerke;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void Lauter()
{
if (Lautstaerke < 95) Lautstaerke += 5;
GesicherteLautstaerke = Lautstaerke;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}
void TonAus()
{
if (Lautstaerke == 0)
{
stream.setVolume(GesicherteLautstaerke);
lcd.setCursor(0, 1);
lcd.print("Ton ein ");
Lautstaerke = GesicherteLautstaerke;
}
else
{
Lautstaerke = 0;
stream.setVolume(Lautstaerke);
Serial.println("Lautstärke: " + String(Lautstaerke));
lcd.setCursor(0, 1);
lcd.print("Ton aus ");
}
}
void ErsterSender()
{
SenderIndex = 0;
Serial.println(SenderIndex);
stream.stopSong();
stream.connecttohost(Sender[SenderIndex]);
// Sender/Lautstärke auf dem LCD anzeigen
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Beschreibung[SenderIndex]);
lcd.setCursor(0, 1);
lcd.print("Lautst\xe1rke: " + String(Lautstaerke) + " ");
}Letzte Aktualisierung: