I've just looked at the zip file :
.h
Licence stuff . . .
#include <Wire.h>
#ifndef TEA5767Radio_h
#define TEA5767Radio_h
class TEA5767Radio
{
private:
int _address;
public:
TEA5767Radio();
TEA5767Radio(int address);
void setFrequency(float frequency);
void setFrequency();
};
#endif
.cpp
Licence stuff . . .
#include <Arduino.h>
#include <TEA5767Radio.h>
TEA5767Radio::TEA5767Radio(int address)
{
_address = address;
}
TEA5767Radio::TEA5767Radio()
{
_address = 0x60;
}
void TEA5767Radio::setFrequency(float frequency)
{
unsigned int frequencyB = 4 * (frequency * 1000000 + 225000) / 32768;
byte frequencyH = frequencyB >> 8;
byte frequencyL = frequencyB & 0XFF;
Wire.beginTransmission(_address);
Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(0xB0);
Wire.write(0x10);
Wire.write(0x00);
Wire.endTransmission();
delay(100);
}
.ino
#include <TEA5767Radio.h>
#include <Wire.h>
int led=13;
TEA5767Radio radio = TEA5767Radio();
void setup()
{
Wire.begin();
Serial.begin(9600);
}
void loop()
{
Serial.println(1);
delay(1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(104.7);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(88.1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(88.3);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(88.1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(88.7);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(88.9);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(89.1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(89.1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(89.3);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(89.1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
radio.setFrequency(89.7);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
. . .
and stacks more of this
. . .
radio.setFrequency(108.1);
digitalWrite(led,HIGH);
delay(1);
digitalWrite(led,LOW);
delay(1);
}
You have understood that it does not scan the entire band, it simply picks out predefined frequencies and delays 2 millisecond between selection and repeats the whole thing endlessly ?
If you want to vary the rate at which it changes channel with a 10k pot, in principle you wire the wiper to an analogue pin, say A0, and wire the other two pins between between the power rails. You use analogRead( ) and get a value between 0 and 1023. It is this result which you must map to the desired period between channel changes. If you continue to use a whole series of delay() statements to control this period, the pot will appear unresponsive unless you read it between each channel change. Ideally you'd restructure the whole thing to avoid huge amounts of repeated code and eliminate the delay() statements.