#include <Wire.
h>
#include <TEA5767Radio.h>
#include <LiquidCrystal.h>
#define SPEAKER_PIN 6
#define PHRASE_INTERVAL 30000 // 30 seconds
#define DISPLAY_DURATION 3000 // 3 seconds
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
TEA5767Radio radio;
const char* phrases[] = {
"Is anyone here?",
"Please talk to us.",
"We can hear you.",
"Give us a sign.",
"Are you there?",
"Make a sound."
};
const int numPhrases = sizeof(phrases) / sizeof(phrases[0]);
unsigned long lastPhraseTime = 0;
void setup() {
[Link](16, 2);
pinMode(SPEAKER_PIN, OUTPUT);
[Link]();
[Link](87.5); // Set initial frequency
}
void loop() {
unsigned long currentTime = millis();
// Scan for stations
for (float freq = 87.5; freq <= 108.0; freq += 0.1) {
[Link](freq);
delay(200); // Small delay to tune the frequency
// Play a tone based on the signal strength
int signalStrength = [Link]();
int toneFrequency = map(signalStrength, 0, 100, 500, 2000);
tone(SPEAKER_PIN, toneFrequency, 200); // Play a tone for 200 milliseconds
// Display frequency on LCD
[Link](0, 0);
[Link]("Frequency: ");
[Link]([Link]());
[Link](" MHz");
// Randomly display a phrase every 30 seconds
if (currentTime - lastPhraseTime >= PHRASE_INTERVAL) {
lastPhraseTime = currentTime;
[Link](0, 1);
int phraseIndex = random(numPhrases);
[Link](phrases[phraseIndex]);
delay(DISPLAY_DURATION);
[Link](0, 1);
[Link](" "); // Clear the phrase after 3 seconds
}
delay(800); // Wait for 800 milliseconds before tuning to the next frequency
}
}