Go Down

Topic: ELECHOUSE fm transmitter V2 and arduino uno (Read 612 times) previous topic - next topic

vdomingo2

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

spycatcher2k

The IDE gives YOU error in TEXT - please post the TEXT, not pictures!
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

CtrlAltElite

Why don't you just copy and paste the error message, using only a couple of hundred bytes?
Where is your code?
Has there been an outbreak of the stupid virus, and I didn't get the memo?

vdomingo2

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;
    }
  }
}

CtrlAltElite

I like your use of italics, but I still can't see your error message.
Has there been an outbreak of the stupid virus, and I didn't get the memo?

CtrlAltElite

Code: [Select]
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.
Has there been an outbreak of the stupid virus, and I didn't get the memo?

vdomingo2

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.

CtrlAltElite

Did I dream an earlier post (after your post #4), or did you delete it? :O
Has there been an outbreak of the stupid virus, and I didn't get the memo?

vdomingo2

thanks for the replies.

I fixed it.

I just modify header file. and it works.

redmirr12

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

Go Up