Hi everyone!
I desire connect 2 Evaluation Board for Si4703 FM Tuner (https://www.sparkfun.com/products/10663) via I2C , i want set the 2 tuners with 2 diferent frequencies (or radio station channels) for each one , i probe this sketch and modified add the others tunners , i can power on the 2 tunners but i cant set each one with a diferent channel. How i can do it?
the sketch:
#include <Si4703_Breakout.h>
#include <Wire.h>
int resetPin = 2;
int resetPin1 = 4;
int SDIO = A4;
int SCLK = A5;
int channel = 1065;
int channel2 = 977;
Si4703_Breakout radio(resetPin, SDIO, SCLK);
Si4703_Breakout radio1(resetPin1, SDIO, SCLK);
//int channel;
int volume;
char rdsBuffer[10];
void setup()
{
Serial.begin(9600);
Serial.println(“\n\nSi4703_Breakout Test Sketch”);
Serial.println(“===========================”);
Serial.println(“a b Favourite stations”);
Serial.println(“+ - Volume (max 15)”);
Serial.println(“u d Seek up / down”);
Serial.println(“r Listen for RDS Data (15 sec timeout)”);
Serial.println(“Send me a command letter.”);
radio.powerOn();
radio1.powerOn();
radio.setVolume(8);
radio1.setVolume(8);
radio.setChannel(1065);
radio1.setChannel(977);
}
void loop()
{
if(resetPin1==LOW)
{
radio1.setChannel(98.1);
}
if (Serial.available())
{
char ch = Serial.read();
if (ch == ‘u’)
{
channel = radio.seekUp();
displayInfo();
}
else if (ch == ‘d’)
{
channel = radio.seekDown();
displayInfo();
}
else if (ch == ‘+’)
{
volume ++;
if (volume == 16) volume = 15;
radio.setVolume(volume);
displayInfo();
}
else if (ch == ‘-’)
{
volume --;
if (volume < 0) volume = 0;
radio.setVolume(volume);
displayInfo();
}
else if (ch == ‘a’)
{
channel = 977; // Rock FM
radio1.setChannel(channel2);
displayInfo();
}
else if (ch == ‘b’)
{
channel = 1065; // BBC R4
radio.setChannel(channel);
displayInfo();
}
else if (ch == ‘r’)
{
Serial.println(“RDS listening”);
radio.readRDS(rdsBuffer, 15000);
Serial.print(“RDS heard:”);
Serial.println(rdsBuffer);
}
}
}
void displayInfo()
{
Serial.print(“Channel:”);
Serial.print(channel);
Serial.print(" Volume:");
Serial.println(volume);
}