// Based on the Origanl sample code of www.elechouse.com @brief example of FMRX_MODULE // This radio can be pruchased at www.elechouse.com // GBH 1/2/2014 Mod for "Ghost Box " #include #include float channel; void setup(void) { Serial.begin(9600); // setup serial communications to the host i2c_init(); // Setup IC2 for use pins (A4 and A5) arduino uno fmrx_read_reg(fmrx_reg_r); // Start FMRX fmrx_set_volume(8);// Set Default start up Volume changing the value on the next line will increase or decrease the signal strength used to determine the radio has found a station fmrx_set_rssi(0); // This tells the radio what is a strong engough signal to stop on .. we use 0 -5 for better low signal responce fmrx_select_band(BAND_US); // 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 channel=fmrx_seek(SEEK_DOWN); // find a chanel to start on. } /* commands are 1 increase volume 2 decrease volume 3 scan up x to exit 4. scan down x to exit */ void loop(void) { static int vol=8; if(Serial.available()>0){ switch(Serial.read()){ case '1': // Increase Volume if(vol < 0x0F){ vol++; } fmrx_set_volume(vol); Serial.print("Volume+:"); Serial.println(vol); Serial.print("\r\n"); break; case '2': // decrease volume if(vol > 0){ vol--; } fmrx_set_volume(vol); Serial.print("Volume-:"); Serial.println(vol); Serial.print("\r\n"); break; case '3': // Scan up Exit on 'x' do{ channel = fmrx_seek(SEEK_UP); Serial.print(channel); Serial.print("\r\n"); delay(150); // change this amount to increase time stopped on a station if(Serial.read()=='x'){break;} // Enter 'x' to exit scan up } while (1==1); break; case '4': // Scan Down Exit on 'x' do{ channel = fmrx_seek(SEEK_DOWN); Serial.print(channel); Serial.print("\r\n"); delay(150); // change this amount to increase time stopped on a station if(Serial.read()=='x'){break;} // Enter 'x' to exit scan up } while (1==1); break; } } }