Total newbie to Arduino, so please excuse me and maybe i have jumped in too far, but this is what i have done so far.
Installed the latest ide, installed the FMRX library to the correct destination folder in libararies.
to test it works, i have copied the example, clicked to compile and get the following error message
fmrx_demo.ino: In function 'void setup()':
fmrx_demo:25: error: 'i2c_init' was not declared in this scope
fmrx_demo:27: error: 'fmrx_power' was not declared in this scope
fmrx_demo:28: error: 'fmrx_reg_r' was not declared in this scope
fmrx_demo:28: error: 'fmrx_read_reg' was not declared in this scope
fmrx_demo:32: error: 'fmrx_set_volume' was not declared in this scope
fmrx_demo:36: error: 'fmrx_set_rssi' was not declared in this scope
fmrx_demo:45: error: 'BAND_EU' was not declared in this scope
fmrx_demo:45: error: 'fmrx_select_band' was not declared in this scope
fmrx_demo:47: error: 'SEEK_DOWN' was not declared in this scope
fmrx_demo:47: error: 'fmrx_seek' was not declared in this scope
fmrx_demo.ino: In function 'void loop()':
fmrx_demo:56: error: 'u8' does not name a type
fmrx_demo:61: error: 'SEEK_DOWN' was not declared in this scope
fmrx_demo:61: error: 'fmrx_seek' was not declared in this scope
fmrx_demo:69: error: 'SEEK_UP' was not declared in this scope
fmrx_demo:77: error: 'vol' was not declared in this scope
fmrx_demo:80: error: 'vol' was not declared in this scope
fmrx_demo:80: error: 'fmrx_set_volume' was not declared in this scope
fmrx_demo:97: error: 'u8' was not declared in this scope
fmrx_demo:97: error: expected `;' before 'i'
fmrx_demo:99: error: 'i' was not declared in this scope
fmrx_demo:102: error: 'buf' was not declared in this scope
fmrx_demo:111: error: 'buf' was not declared in this scope
fmrx_demo:112: error: 'fmrx_set_freq' was not declared in this scope
/**
@file fmrx_demo.ino
@author www.elechouse.com
@brief example of FMRX_MODULE
For this demo, input character '1' from serial monitor to seek channel down, '2' to seek down
'3' to volume up, '4' to volume down.'&xxxx' (x is for a number) to manually set receive FM frequency
@section HISTORY
V1.0 initial version
Copyright (c) 2012 www.elechouse.com All right reserved.
*/
/** include library */
#include <FMRX.h>
float channel;
void setup(void)
{
Serial.begin(9600);
Serial.print("FM-RX Demo By Elechosue\r\n");
/** I2C initial */
i2c_init();
fmrx_power();
fmrx_read_reg(fmrx_reg_r);
Serial.print("FMRX Module Power up.\r\n");
/** set volume */
fmrx_set_volume(10);
Serial.println("Volume Set");
/** receive signal strength set, range:0-127*/
fmrx_set_rssi(15);
/**
select a band, parameter:
BAND_EU: 87-108MHz, Europe
BAND_US: 87-108MHz, USA
BAND_JP: 76-91MHz, JAPAN
BAND_JP_WIDE: 76-108MHz, JAPAN wide
*/
fmrx_select_band(BAND_EU);
channel=fmrx_seek(SEEK_DOWN);
Serial.println("Initial seek.");
Serial.print("Channel:");
Serial.print(channel, 2);
Serial.println("MHz");
}
void loop(void)
{
static u8 vol=10;
if(Serial.available()>0){
switch(Serial.read()){
case '1':
Serial.println("Wait...");
channel = fmrx_seek(SEEK_DOWN);
Serial.println("Seek down.");
Serial.print("Channel:");
Serial.print(channel, 2);
Serial.println("MHz");
break;
case '2':
Serial.println("Wait...");
channel = fmrx_seek(SEEK_UP);
Serial.println("Seek up.");
Serial.print("Channel:");
Serial.print(channel, 2);
Serial.println("MHz");
break;
case '3':
Serial.println("Wait...");
if(vol < 0x0F){
vol++;
}
fmrx_set_volume(vol);
Serial.print("Volume+:");
Serial.println(vol);
break;
case '4':
Serial.println("Wait...");
if(vol > 0){
vol--;
}
fmrx_set_volume(vol);
Serial.print("Volume-:");
Serial.println(vol);
break;
/** check data for setting new channel. Input data must start with '&' and followed by 4 numbers, the first 3 is the integer part
(Unit: MHz), the last one is the decimal part.And the channel must between 76MHz and 108Mhz.(eg: &0756 for 75.6MHz, and &0666 is out of range)
*/
case '&':
u8 i,buf[4];
float ch;
i=0;
delay(30);
while(Serial.available()&&i<4){
buf[i]=Serial.read();
if (buf[i]<= '9' && buf[i]>= '0') {
i++;}
else{
i=0;
break;
}
}
if (i==4){
ch = (buf[0]-'0')*100+(buf[1]-'0')*10+(buf[2]-'0')*1+0.1*(buf[3]-'0');
Serial.println(fmrx_set_freq(ch),2);
}else{
Serial.println("Input Error.");
}
/** dummy read for useless character */
while(Serial.available()){
Serial.read();
}
break;
}
}
}