ELECHOUSE fm transmitter V2 and arduino uno

Good day!

I’m trying to compile my Fm transmitter project using the Fm transmitter shield from elechouse and Arduino Uno. I’m trying to use their example code but I always get an error as shown in the images.

thanks

(deleted)

Why don’t you just copy and paste the error message, using only a couple of hundred bytes?
Where is your code?

here is the code:

/**
@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 “U8glib.h”
#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 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
=Serial.read();*
if (buf_<= ‘9’ && buf*>= ‘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;*
* }*
* }*
}

I like your use of italics, but I still can't see your error message.

 typedef uint16_t u16;

I don't know why anyone would do that, because uint16_t is a pretty universally understood datatype. I don't have your libraries, but I would standardise on uint16_t everywhere it is needed, and ditch the u16 rubbish.

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\v Domingo\Documents\Arduino\libraries\FMTX\examples\fmtx_demo\fmtx_demo.ino:16:0:

C:\Users\VDomingo\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 (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:233:0,

from sketch\fmtx_demo.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h:30:24: note: previous declaration as 'typedef short unsigned int u16'

typedef unsigned short u16;

^

exit status 1 Error compiling for board Arduino/Genuino Uno.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Did I dream an earlier post (after your post #4), or did you delete it? :O

thanks for the replies.

I fixed it.

I just modify header file. and it works.

hi may i know how you fix the error? because im using the same fm transmitter and arduino and it show up an error. i already try to fix it but still the error wont go away

i found a solution. it somehow can compile using arduino IDE 1.5 version.

I had the same problem and I solve it doing the following modifications.

  1. in the FMTX.h library commented all redefine lines, like this:

.........

ifndef __TYPE_REDEFINE

define __TYPE_REDEFINE

//typedef uint8_t u8; //typedef int8_t s8; //typedef uint16_t u16; //typedef int16_t s16; //typedef uint32_t u32; //typedef int32_t s32;

endif

....

  1. in code replace the line

u8 i,buf[4];

with the line

uint8_t i,buf[4];

and the code uploads just fine.