BERBAGI

ZONADUINO.NET- Halo kawan, dipenghujung Bulan Januari 2017 ini Admin kembali menyapa kalian dengan Project-Project Arduino. Radio FM mungkin tak asing lagi bagi kawan-kawan, pada 26 Desember 1933 Radio FM dikenalkan oleh Edwin Howard Armstrong di Amerika dan pada Postingan kali ini Admin memberi judul “Cara Membuat Radio FM Sederhana Menggunakan Arduino”

Alat dan Bahan:

  1. Arduino UNO & Genuino UNO × 1
  2. Breadboard x 1
  3. Si4703 FM Board x1
  4. Headphones x1

Skema:

Coding :

/*         Cara Membuat Radio FM Sederhana Menggunakan Arduino
                             Version 1.0        
                          www.zonaduino.net                       */


#include <SparkFunSi4703.h>
#include <Wire.h>

const int resetPin = 2;
const int SDIO = A4;
const int SCLK = A5;

Si4703_Breakout radio(resetPin, 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();
  radio.setVolume(0);
}

void loop()
{
  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 = 930; // Rock FM
      radio.setChannel(channel);
      displayInfo();
    }
    else if (ch == 'b')
    {
      channel = 974; // 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); 
}

LEAVE A REPLY