Hi there,
I just got the Elechouse FM Transmitter from AliExpress, and after searching through the forums and finding solutions but I couldn't find any answers. I'm using the demo script supplied by the company:
/**
@file fmrx_demo.ino
@author www.elechouse.com
@brief example of FMRX_MODULE
For this demo, input command format like &xxxx to set select band,
(eg:if you want to set FM 95.6MHz,then input &0956 and send).
@section HISTORY
V1.0 initial version
Copyright (c) 2012 www.elechouse.com All right reserved.
*/
#include <FMTX.h>
float fm_freq = 90; // Here set the default FM frequency
void setup(void)
{
Serial.begin(9600);
Serial.print("FM-TX Demo\r\n");
/**
Initial, set FM channel and select your area:
USA
EUROPE
JAPAN
AUSTRALIA
CHINA
*/
fmtx_init(fm_freq, USA);
Serial.print("Channel:");
Serial.print(fm_freq, 1);
Serial.println("MHz");
}
void loop(void)
{
/** check for data setting new frequency. Users could input data from Serial monitor. Data
must start with '&' and followed by 4 numbers, such as &8000. The first two is the integer part
of new frequency (Unit: MHz), and the last one is the decimal part. And the channel must between 70MHz
and 108Mhz. For example, &756 is 75.6MHz, and &666 is [hr]out of range.
*/
if(Serial.available()){
switch(Serial.read()){
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');
if(ch>=70&&ch<=108){
Serial.print("New Channel:");
Serial.print(ch, 1);
Serial.println("MHz");
fmtx_set_freq(ch);
}else{
Serial.println("ERROR:Channel must be range from 70Mhz to 108Mhz.");
}
}else{
Serial.println("ERROR:Input Format Error.");
}
while(Serial.available()){
Serial.read();
}
break;
}
}
}
Everything should work, I even used an I2C checker which ran fine. I have wired everything correctly as per Theory Circuit (http://www.theorycircuit.com/arduino-fm-transmitter/) but I still get this error:
In file included from C:\Users\marsh\Documents\Arduino\libraries\FMTX\examples\fmtx_demo\fmtx_demo.ino:16:0:
C:\Users\marsh\Documents\Arduino\libraries\FMTX/FMTX.h:32:18: error: conflicting declaration 'typedef uint16_t u16'
typedef uint16_t u16;
^
In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:233:0,
from C:\Users\marsh\AppData\Local\Temp\arduino_build_848401\sketch\fmtx_demo.ino.cpp:1:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/USBAPI.h:30:24: note: previous declaration as 'typedef short unsigned int u16'
typedef unsigned short u16;
^
Using library FMTX in folder: C:\Users\marsh\Documents\Arduino\libraries\FMTX (legacy)
exit status 1
Error compiling for board Arduino/Genuino Uno.
If you can help please do. I need this for a project and needs to be ready soon. Keep in mind that I am a beginner.
Hope you can help! ![]()