程序还没有全部写完,只是弄出了个框架,特别是收发转换那里。发在这里供大家讨论与完善程序。设定工作频率为108MHZ
#include <Arduino.h>
#include <Wire.h>
#include <radio.h>
#include <RDA5807M.h>
#include <FMTX.h>
RDA5807M radio; // Create an instance of Class for RDA5807M Chip
RADIO_INFO ri;//rssi
float fm_freq = 108;
void rx(void);
void tx(void);
void setup() {
pinMode(3, INPUT);
//sets interrupt to check for button talk abutton press
attachInterrupt(1, tx, CHANGE);
//sets the default state for each module to recevie
rx(); // put your setup code here, to run once:
}
void rx(void)
{
radio.init();
radio.setFrequency(10800);
// Enable information to the Serial port
//radio.debugEnable();
//radio.setBandFrequency(FIX_BAND, FIX_STATION );
radio.setVolume(4);
radio.setMono(false);
radio.setMute(false);
}
void tx(void)
{
fmtx_init(fm_freq, CHINA);
fmtx_set_freq(fm_freq);
}
void loop() {
radio.getRadioInfo(&ri);//mute control
if((ri.rssi)>=7)
radio.setMute(false);
else if((ri.rssi)<7)
radio.setMute(true); // put your main code here, to run repeatedly:
}
//arduino FM walkie talkie |