background image

//Add the Si4703 Library to the sketch. 
#include <Si4703.h> 
#include <Wire.h> 

//Create an instance of the Si4735 named radio. 
Si4703 radio; 

void setup() 

  //Create a serial connection 
  Serial.begin(9600); 

  //Initialize the radio to the FM mode (Possible modes are AM, FM, S
W, LW). 
  //The mode will set the proper bandwidth. Ensure that the antenna 
  //switch on the shield is configured for the desired mode. 
  radio.begin(); 

  //Set the FM Frequency to 97.3 MHz 
  radio.tuneFrequency(973); 

The setup and initialization is pretty easy. We start by including the Si4703 and Wire 
libraries. The Wire library is needed for I2C communication, which is what is used to 
talk to the radio receiver. The Si4703 library has the functions we need to control the 
radio receiver. Next we create a variable (or instance) of the Si4703 library called 
‘radio.’ In the setup section all we do is create a serial connection, and use the ‘begin’ 
function of the radio library to initialize the Si4703. Finally we tell the Si4703 to tune to 
97.3 MHz. Once things are set up, we get into the loop routine which handles the 
serial communication and sending commands to the Si4703.

Page 5 of 7

Отзывы: