background image

void loop() 
{        
  //Wait until a character comes in on the Serial port. 
  if(Serial.available()>0) 
  { 
    //Decide what to do based on the character received. 
    switch(Serial.read()){ 
      //If we get the number 8, turn the volume up. 
      case '8':radio.volume(UP); 
        break; 
      //If we get the number 2, turn the volume down. 
      case '2':radio.volume(DOWN); 
        break; 
      //If we get the number 4, seek down to the next channel in the cu
rrent bandwidth (wrap to the top when the bottom is reached). 
      case '4':radio.seek(DOWN); 
        break; 
      //If we get the number 6, seek up to the next channel in the curr
ent bandwidth (wrap to the bottom when the top is reached). 
      case '6':radio.seek(UP); 
        break; 
      //If we get the letter m, mute the radio. 
      case 'M': 
      case 'm':radio.toggleMute(); 
        break; 
      default: 
        break; 
    } 
  }    
} //End main loop 

The loop routine is also pretty straightforward. The loop waits for input from the serial 
terminal. Once a character is received, a decision is made. Depending on what the 
character is one of the library functions for the Si4703 is executed.

Conclusion

To find out what other functions there are in the Si4703 library, go into your libraries 
folder for Arduino (the same one you unzipped the folder in) and open the Si4703.h 
file with a text editor. This file will tell you all of the functions that exist in the library. 
Play around with it, and if you come up with some cool new functions for the library 
mention it in the comments so other people can use it as well. Good luck hacking! If 
you have any problems, feel free to contact SparkFun Technical Support at 
[email protected]

Page 6 of 7

Reviews: