//-----------------------------------------------------------------------------------------------------------------------
// DAB+ tuner V2.2.3b
//
// Created: 01/10/2016
//
// Commands for DAB+ tuner print.
//
// Author: Staf Van Gestel
//
// With this software you can use the DAB+ tuner on a UNO, controlled with 5 keys and a 2x16 LCD.
// it is written in a way that students (age of 15-16 year)could understand the software.
//
// License ? Feel free to use and improve or expand this software. But I'm not responsible for any changes you make.
//
// Configuration:
// On Off button on port 3
// Mode button on port 8 Mode is for switching between Streammode(DAB or FM), Tune (P or S) and Volume (V).
// Up/Select button on port 9 When DAB is active, tuner is switched to FM and viceversa.
// When Tune is active (P in DAB or S in FM) one selected or search for next station.
// When Volume is active, volume is raised with one, max is 16.
// Down button on port 10 When Tune is active (P in DAB or S in FM) one selected or search for previous station.
// When Volume is active, volume is reduced with one, min is 0.
// DAB Search button on port 13, only active in DAB-mode
//
// The DAB search should be done each time when you use the tuner is in a new environment.
// The search takes some time.
// In this program, database is cleared before searched. Data is not sorted and not 'pruned'.
//
// 13/05/2017 changing RESET function : now via digitalout 2
// before this output was used to power the FET (minor changes in pcb are required)
//
// IMPORTANT NOTICE : the baudrate should be set on 57601
//
// 09/01/2019 Because tuner did not respond anymore after a while, signalstrength is not displayed anymore.
// it is possible that the request for this value was to much (every 0.5s).
// Also the slavesetnotifications are not actived anymore, so the tuner is not sending any
// unexpected data anymore. It needs another user-interface to handle this data.
// V2.2.2
// 09/02/2019 New routine for handling response of tuner. Herefore some functions are redesigned because all
// returned serial data is handled by one procedure...
// V2.2.3b
// 20/02/2019 Sometimes, in DAB-mode the software stopped working.
// After long testing, with the help of a persisiting user, this should be a version without any strange errors.
// Some extra conditions where added in while loops so that unexpected data in de serial buffer where filtered.
// But there was still one strange problem with the DAB-search. On the Arduino of one client, the search did not work in
// V2.3. This version was 100% working on 4 Arduino's of mine.
// At the end there was put an short delay after the DAB search command. Problem solved (!?).
// Baudrate should be at 57601 as mentioned in some forums (like : https://forum.arduino.cc/index.php?topic=164319.15)
//
//--------------------------------------------------------------------------------------------------------------------------------
#include <Wire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,7,6,5,4);
#include <stdlib.h>
const char SYSTEM = 0x00;
const char STREAM = 0x01;
/* Next constants are for knowing the playmode or streammode of the tuner */
const byte DAB = 0;
const byte FM = 1;
const byte BEEPER = 2;
const byte AM = 3;
const byte STREAMSTOP = 0xFF;
byte StreamMode = 0;
/* Next constants are for the mode where the program is in */
const char VOLUME = 1;
const char STREAMMODE = 2;
const char SEARCH = 3;
const char MAXMODE = 3; // changes this value to previous const, so at this moment this is SEARCH
const char ON = 1;
const char OFF = 2;
/* Next constants are for knowing the play status of the tuner */
const byte PlayStatus = 0;
const byte SearchingStatus = 1;
const byte TuningStatus = 2;
const byte StopStatus = 3;
const byte SortingChangeStatus = 4;
const byte ReconfigurationStatus = 5;
byte TunerStatus = 3;
/* next constants are for the inputs for processing the inputs for controlling the tuner */
const char OnOffKnop = 3;
const char ModeKnop = 8;
const char UpSelectKnop = 9;
const char DownKnop = 10;
const char DABSearchKnop = 13;
/* next global variabels are for remembering the status of the program */
byte Power = OFF;
byte Streaming;
byte Volume = 10;
byte Mode = 1;
byte SignalStrength = 0;
byte BitErrorRate1 = 0;
byte BitErrorRate2 = 0;
byte StereoMode = 0;
byte Stereo = 0;
boolean DABChanged = false; // needed for asking station data only once
boolean FMFreqChanged = false;
boolean FMProgTextChanged = false;
boolean FMProgNameChanged = false;
char InfoText[16]; // info on screen for 16 characters
int InfoTextIndex = 0;
int InfoMaxText = 0;
boolean InfoTextAv = false;
volatile unsigned char ProgText[64];
char zero = 0x00; // because of compiler error when using Arduino DUE
int currentDABprog = 0;
int totalDABSearchProg = 0;
int displaySetTeller = 0;
long totalDABprog = 0;
long FMfrequency = 87500;
volatile unsigned char ReturnData[64];
//----------------------------------------------
// function for checking the respons of the tuner
// Respons is the same for most commands.
//-----------------------------------------------
byte CheckRespons(unsigned int timeout) {
int TOteller = 0;
int index = 0;
int nbrOfSerData = 0;
int aantKar = 0;
unsigned long resp = 0;
unsigned long result = 0;
unsigned char ReturnData[64]; // Serile buffer is 64 byts groot.
do {
// Time for tuner to respons
delay(10);
TOteller++;
} while ((Serial.available() == 0) && TOteller <= timeout);
if (TOteller >= timeout) {
return(-2);
}
// starting to find begin of message, message starts with FE
while (Serial.available() > 0) {
do {
ReturnData[0] = Serial.read();
} while ((ReturnData[0] != 0xFE)&& (Serial.available()!=0)); // reading buffer until first character FE
index = 1;
do {
ReturnData[index] = Serial.read();
index++;
} while ((ReturnData[index-1] != 0xFD) && (index < 64)&& (Serial.available()!=0));
switch(ReturnData[1]) {
case 0x00: { //ACK NACK
switch (ReturnData[2]) {
case 0x01:
return(0);
break;
case 0x02:
return(1);
break;
}
return(-1);
break;
}
case 0x01: {
switch (ReturnData[2]) {
case 0x05: // get play status
TunerStatus = ReturnData[6];
return(0);
break;
case 0x06: // get play mode;
StreamMode = ReturnData[6];
return(0);
break;
case 0x07: // get play index
resp = ReturnData[6];
result += resp << 24;
resp = ReturnData[7];
result += resp << 16;
resp = ReturnData[8];
result += resp << 8;
resp = ReturnData[9];
result += resp;
if (StreamMode == FM) {
FMfrequency = result;
FMFreqChanged = true;
}
else if (StreamMode == DAB) {
currentDABprog = result;
DABChanged = true;
}
return(0);
break;
case 0x08: // get signalstrength
lcd.setCursor(5,1);
SignalStrength = ReturnData[6];
BitErrorRate1 = ReturnData[7];
BitErrorRate2 = ReturnData[8];
if (SignalStrength <= 100) {
lcd.setCursor(8,1);
return(0);
}
else
{
lcd.setCursor(10,1);
return(1);
}
break;
case 0x0A: // get stereo mode
StereoMode = ReturnData[6];
return(0);
break;
case 0x0B: // get stereo
Stereo = ReturnData[6];
return(0);
break;
case 0x0D: // get volume
Volume = ReturnData[6];
return(0);
break;
case 0x0F: // get programname
for (int tel = 0; tel < 16; tel++)
InfoText[tel] = ' ';
aantKar = ReturnData[5];
index = 0;
if (aantKar > 16) aantKar = 16;
for (int tel=7; tel<= (aantKar+6); tel+=2){ // 0x00 between characters
InfoText[index] = ReturnData[tel];
index++;
}
return(0);
break;
case 0x16: // get total program of DAB in database
resp = ReturnData[6];
result += resp << 24;
resp = ReturnData[7];
result += resp << 16;
resp = ReturnData[8];
result += resp << 8;
resp = ReturnData[9];
result += resp;
totalDABprog = result;
return(0);
break;
case 0x1A: // get service name
for (int tel = 0; tel < 16; tel++)
InfoText[tel] = ' ';
aantKar = ReturnData[5];
index = 0;
if (aantKar > 16) aantKar = 16;
for (int tel=7; tel<= (aantKar+7); tel+=2){ // 0x00 between characters
InfoText[index] = ReturnData[tel];
index++;
}
return(0);
break;
case 0x1B: // get search program
totalDABSearchProg = ReturnData[6];
return(0);
break;
}
return(-2);
break;
}
return(-3);
break;
}
}
//-------------------------------------------------------------
// SLAVESetNotification
// With this command you set the slave to send notifications.
// Here we only set the Scan Frequency Notification
// The slave returns then the frequency after scanning
//------------------------------------------------------------
/* inactive in this program
int SLAVESetNotification(void) {
Serial.write(0xFE);
Serial.write(0x07);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x02);
Serial.write(zero);
Serial.write(0x01);
Serial.write(0xFD);
return(CheckRespons(1000));
*/
}
//*********************************************************************************/
// GetSysRdy : Asking if system is ready to receive commands
// returns 0 is system is ready,
// returns 1 is system is not ready,
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
byte GetSysRdy(void) {
Serial.write(0xFE);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// SysRstDatabase : reset database
// returns 0 is databasereset is ready,
// returns 1 is system is not ready,
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
byte SysRstDatabase(void) {
Serial.write(0xFE);
Serial.write(zero);
Serial.write(0x01);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x01);
Serial.write(0x02);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// GetPlayIndex : Get Program index of current DAB program of FM RF frequency
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
byte GetPlayIndex(void) {
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x07);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// GetSignalStrength : Get current signal strength FM or DAB
// returns signal strength DAB 0~18 FM 0~100
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
byte GetSignalStrength(void) {
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x08);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// GetServiceName : Get service name of current DAB program
// returns ,
// returns ,
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
byte GetServiceName(unsigned long DABprogram) {
unsigned char prog1 = DABprogram & 0xFF;
unsigned char prog2 = DABprogram >> 8 & 0xFF;
unsigned char prog3 = DABprogram >> 16 & 0xFF;
unsigned char prog4 = DABprogram >> 24 & 0xFF;
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x1A);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x05);
Serial.write(prog4);
Serial.write(prog3);
Serial.write(prog2);
Serial.write(prog1);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// GetProgramText : get current DAB/FM program text
// returns ,
// returns ,
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
/* function not active in current program.
byte GetProgramText(void) {
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x10);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
*/
//*********************************************************************************/
// GetFMProgramName : get current FM program name
// returns ,
// returns ,
// returns -1 when there is a problem with communication,
// returns -2 no respons from tuner, timeout.
//*********************************************************************************/
byte GetFMProgramName(void) {
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x0F);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x05);
Serial.write(0xFF);
Serial.write(0xFF);
Serial.write(0xFF);
Serial.write(0xFF);
Serial.write(0x01); // long name
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// SetVolume : setting volume of DAB+tuner
// Initialy the volume is 0 = Mute.
// Parameter is a number from 0 to 16
// Returns status of action
// 0 : volume is set,
// 1 : volume is not set; wait and try again,
// -1 : unknown error, probably communication error,
// -2 : no respons from tuner.
//*********************************************************************************/
byte SetVolume(char volume){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x0C);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x01);
Serial.write(volume);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// FMSearch : search FM-band
// parameter is direction of search : 0 = backward or 1 = forward
// Returns status of action
// 0 : search is done
// 1 : search is not done; wait and try again
// -1 : unknown error, probably communication error
// -2 : no respons from unit.
//*********************************************************************************/
byte FMSearch(char Direction){
int response = 0;
int teller = 0;
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x02);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x01);
Serial.write(Direction);
Serial.write(0xFD);
response = CheckRespons(1000);
if (response == 0){
lcd.clear();
lcd.print("FMSearch starts");
TunerStatus = SearchingStatus;
lcd.setCursor(0,1);
teller = 0;
while (TunerStatus == SearchingStatus){
response = GetTunerPlayStatus();
delay(1000);
teller++;
if (teller > 15) {
teller = 0;
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
}
lcd.print('.');
}
response = GetPlayIndex();
}
return (response);
}
//*********************************************************************************/
// SetFMFreq : setting tuner on certain frequency
// Frequency must be set in hex code
// Parameter is a frequency from 155CC (87500 kHz) to 1A5E0 (108000 kHz).
// Returns status of action
// 0 : freq is set,
// 1 : freq is not set; wait and try again,
// -1 : unknown error, probably communication error,
// -2 : no repsons from tuner.
//*********************************************************************************/
byte SetFMFreq(unsigned long frequency){
unsigned char freq1 = frequency & 0xFF;
unsigned char freq2 = frequency >> 8 & 0xFF;
unsigned char freq3 = frequency >> 16 & 0xFF;
unsigned char freq4 = frequency >> 24 & 0xFF;
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x05);
Serial.write(0x01);
Serial.write(freq4);
Serial.write(freq3);
Serial.write(freq2);
Serial.write(freq1);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// StopFMFreq : stopping current FM stream
//
// Returns status of action
// 0 : streaming is stopped,
// 1 : streaming is not stopped, perhaps streaming was not started,
// -1 : unknown error, probably communication error,
// -2 : no respons from tuner.
//*********************************************************************************/
byte StopFMFreq(void){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x01);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(500));
}
//*********************************************************************************/
// SetDABProg : setting DAB+tuner on certain program
// Program must be between 0 and (STREAM_GetTotalProgram -1)
// Returns status of action
// 0 : prog is set,
// 1 : prog is not set; wait and try again,
// -1 : unknown error, probably communication error,
// -2 : no respons from tuner.
//*********************************************************************************/
byte SetDABProg(char program){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x05);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(program);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// SearchDAB : start DAB search process
// The module will search every frequency between start- and endfrequency.
// Not the frequency itself is used, but indexes (1-40) are used.
// Returns status of action
// 0 : search is done,
// 1 : search is not done; wait and try again,
// -1 : unknown error, probably communication error,
// -2 : no respons from tuner.
//*********************************************************************************/
byte SearchDAB(char startindex, char stopindex){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x03);
Serial.write(zero);
Serial.write(zero);
Serial.write(0x02);
Serial.write(startindex);
Serial.write(stopindex);
Serial.write(0xFD);
return(CheckRespons(5000));
}
//*********************************************************************************/
// GetVolume : getting volume of DAB+tuner
//
// Parameter is a number from 0 to 16
// Returns status of action or volume level
// 0--16: volume,
// -1 : unknown error, probably communication error,
// -2 : no respons from tuner.
//*********************************************************************************/
byte GetVolume(void){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x0D);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*********************************************************************************/
// GetDABTotalSearchProg : total programs found in search process
// Returns status of action
// 0 : prog is set,
// -1 : unknown error, probably communication error,
//*********************************************************************************/
byte GetDABTotalSearchProg(void){
int index = 0;
int response = 0;
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x1B);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
response = CheckRespons(10000);
}
//*********************************************************************************/
// GetDABTotalProg : Total of stations found in DAB database
// Returns one of the following
// # number of programs,
// 1 : prog is not set; wait and try again,
// -1 : unknown error, probably communication error,
// -2 : no respons from tuner.
//*********************************************************************************/
byte GetDABTotalProg(void){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x16);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(1000));
}
//*************************************************************/
// GetTunerPlayStatus : Getting Status of Tuner
// Returns status of command
// 0 : command executed,
// -1 : unknown error, probably communication error,
//*************************************************************/
byte GetTunerPlayStatus(void){
Serial.write(0xFE);
Serial.write(0x01);
Serial.write(0x05);
Serial.write(zero);
Serial.write(zero);
Serial.write(zero);
Serial.write(0xFD);
return(CheckRespons(10000));
}
//---------------------------------------
// SetDisplay
// procedure to display info on lcd
//---------------------------------------
void SetDisplay(){
int response;
int aantKar;
int index = 0;
lcd.setCursor(0,0);
if (StreamMode == DAB) {
lcd.print("DAB");
lcd.print("#");
lcd.print(totalDABprog);
lcd.setCursor(8,0);
lcd.print("P:");
lcd.print(currentDABprog+1);
}
else {
lcd.print("FM ");
lcd.setCursor(8,0);
lcd.print("S ");
}
lcd.setCursor(13,0);
lcd.print("V ");
lcd.setCursor(14,0);
lcd.print(Volume);
if ((StreamMode == DAB) && (DABChanged == true)){
DABChanged = false;
response = GetServiceName(currentDABprog);
if (response == 0) {
lcd.setCursor(0,1);
lcd.print(InfoText);
}
}
if (StreamMode == FM) {
if (FMFreqChanged == true){
FMFreqChanged = false;
FMProgNameChanged = true;
lcd.setCursor(0,1);
lcd.print((FMfrequency/1000.0));
lcd.print(" MHz ");
delay(1000);
response = GetFMProgramName();
if (response == 0) {
FMProgNameChanged = false;
lcd.setCursor(0,1);
lcd.print(InfoText);
}
}
}
response = GetSignalStrength();
if (response == 0) {
lcd.setCursor(13,1);
lcd.print(" ");
lcd.setCursor(13,1);
lcd.print(SignalStrength);
}
else {
lcd.setCursor(13,1);
lcd.print(" ");
lcd.setCursor(13,1);
lcd.print("ERR");
}
if (Mode == STREAMMODE)
lcd.setCursor(0,0);
if (Mode == SEARCH)
lcd.setCursor(8,0);
if (Mode == VOLUME)
lcd.setCursor(13,0);
lcd.blink();
delay(100);
}
//--------------------------------------------
//
// SETUP
//
//--------------------------------------------
void setup() {
pinMode(2,OUTPUT);
digitalWrite(2,LOW);
pinMode(3,INPUT_PULLUP);
pinMode(8,INPUT_PULLUP);
pinMode(9,INPUT_PULLUP);
pinMode(10,INPUT_PULLUP);
pinMode(13,INPUT_PULLUP);
lcd.begin(16,2);
lcd.print("DAB+ Power OFF");
Serial.begin(57601);
delay(1000);
}
//------------------------------------------------
//
// MAIN PROGRAM
//
//------------------------------------------------
void loop() {
int AAN = LOW;
char lcdchar;
int index= 0;
int tel = 0;
int teller = 0;
int response;
int inByte;
int knop;
lcd.setCursor(0,0);
do {
// Search DAB programs
knop = digitalRead(DABSearchKnop);
if ((knop == LOW) && (StreamMode == DAB)&& (Power == ON)){
response = SysRstDatabase();
if (response == 0){
lcd.setCursor(0,1);
lcd.print("Rst database OK ");
delay(1000);
}
else {
lcd.setCursor(0,1);
lcd.print("Rst database NOK");
lcd.setCursor(11,1);
lcd.print(response);
delay(2000);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("searching DAB...");
lcd.setCursor(0,1);
response = SearchDAB(0,40);
if (response == 0){
lcd.print("DABsearch starts");
TunerStatus = SearchingStatus;
lcd.setCursor(0,1);
teller = 0;
while (TunerStatus == SearchingStatus){
delay(100);
response = GetTunerPlayStatus();
if (response == 0) {
teller++;
if (teller > 15) {
teller = 0;
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
}
lcd.print('.');
delay(1000);
}
else {
lcd.print("Err, status:");
lcd.print(response);
delay(1000);
}
}
lcd.setCursor(0,1);
lcd.print("Tuner Status : ");
lcd.print(TunerStatus);
response = GetDABTotalProg();
DABChanged = true;
response = SetDABProg(0);
response = GetPlayIndex();
delay(500);
lcd.clear();
SetDisplay();
displaySetTeller = 0;
}
else {
lcd.setCursor(0,1);
lcd.print("DABsearch not OK");
}
delay(1000);
lcd.setCursor(0,0);
}
// AAN - UIT
knop = digitalRead(OnOffKnop);
if (knop == LOW) {
if (Power == OFF) {
Power = ON;
digitalWrite(2,HIGH);
delay(1000);
do {
lcd.print("Get Systemstatus");
delay(500);
response = GetSysRdy();
if (response == 0){
lcd.setCursor(0,1);
lcd.print("System OK ");
}
else {
lcd.setCursor(0,1);
lcd.print("System NOK ");
lcd.setCursor(11,1);
lcd.print(response);
}
}
while (response != 0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Set Volume ");
lcd.setCursor(0,1);
response = SetVolume(Volume);
if (response == 0){
lcd.print("Volume Set ");
}
else {
lcd.print("Volume Not Set ");
}
delay(1000);
lcd.setCursor(0,0);
lcd.print("Get Volume ");
response = GetVolume();
if (response == 0) {
lcd.setCursor(0,1);
lcd.print("Volume = ");
lcd.setCursor(9,1);
lcd.print(Volume);
}
else {
lcd.setCursor(0,1);
lcd.print("Vol resp= ");
lcd.setCursor(10,1);
lcd.print(response);
}
delay(1000);
lcd.setCursor(0,0);
response = GetDABTotalProg();
lcd.print("#DAB progr: ");
lcd.setCursor(12,0);
lcd.print(totalDABprog);
delay(2000);
response = SetDABProg(0);
DABChanged = true;
if (response != 0){
lcd.setCursor(0,0);
lcd.print("Stream not ready");
lcd.setCursor(0,1);
lcd.print("Returnstatus ");
lcd.print(response);
}
delay(1000);
lcd.clear();
StreamMode = DAB;
SetDisplay();
}
else {
Power = OFF;
digitalWrite(2,LOW);
lcd.clear();
delay(10);
lcd.print("Power : OFF");
delay(2000);
}
}
// MODE
knop = digitalRead(ModeKnop);
if ((knop == LOW) && (Power == ON)) {
Mode++;
if (Mode > MAXMODE) Mode = 1;
delay(1000);
}
...
This file has been truncated, please download it to see its full contents.
Comments