emonTH_DHT22_DS18B20 compile failure

HI,

I'm trying to compile the firmware for emonTH_DHT22_DS18B20 emonTH node. I've setup everything according to documentation (git cloned all the libraries today).

Compile fails with the following message:

emonTH_DHT22_DS18B20.cpp: In function ‘void setup()’:
emonTH_DHT22_DS18B20.cpp:115:13: error: could not convert ‘Serial’ to ‘bool’

 

What might be the problem here?

 

One other question: If I would like to allow for higher resolution measurements (a reading every 10 seconds) is this all what I need to change

 

- const int time_between_readings= 1;

+ const int time_between_readings= 10;

 

- Sleepy::loseSomeTime(time_between_readings*60*1000);

+ Sleepy::loseSomeTime(time_between_readings*1000);

 

 

 

TrystanLea's picture

Re: emonTH_DHT22_DS18B20 compile failure

What version of the arduino IDE are you running? I think the serial bool error may be associated with older versions of the arduino IDE.

To answer your second question, yes that should do it.

cybergibbons's picture

Re: emonTH_DHT22_DS18B20 compile failure

Just tested on 1.05 and 1.55 and it works on both.

hydro-b's picture

Re: emonTH_DHT22_DS18B20 compile failure

I installed all this on Ubuntu Precise (12.04 LTS) ... I'm gonna retry the compile on latest and greatest Arch Linux install. Thanks for testing.

hydro-b's picture

Re: emonTH_DHT22_DS18B20 compile failure

I can confirm it works flawlessly on Arch Linux. Thanks again.

Eric_AMANN's picture

Re: emonTH_DHT22_DS18B20 compile failure

Hi

I got the same error when compiling that sketch (and Tx one).

I am also using arduino 1.0 on Ubuntu 12.04 LTS.

I have to modify it like this

-   if (Serial) debug = 1; else debug=0;                       

+  debug = 1;

 

I want to keep on using Ubuntu. Any idea ?

Eric

 

EDIT : another strange behaviour : I can't directly see all sketches I downloaded with git  in the menu "File->Sketchbook/OpenEnergyMonitor"... To open those missing sketches, I have to go in "File/open'" and select the ino file. Then, I got the following message : "the file xxxx.ino needs to be inside a sketch folder named xxxx. Cretate this folder, move the file and continue". I have no choice to disagree so I accept but it will be a mess in my sketchbook soon ...

 

kits's picture

Re: emonTH_DHT22_DS18B20 compile failure

Hi,

You have to modify in file>preferences the sketchbook location to your git directory.

After an Open/Close of arduino it should appears in your sketchbook, but it may still not work (for me) : link failed cause lib not found.

I'm rather new with Arduino but I find a way to compile/link:

 sudo apt-get install arduino arduino-core (something like that)

 Install 1.05 Arduino and unzip in any directory

 Start your new 1.05 tool. Change Sketchbook location if needed.

 More important : Import lib using Sktech/import library/add library. You may have to rename lib if you have errors.

 Loop for all lib.

 Then restart Arduino and then everything should be OK.

Kits.

Eric_AMANN's picture

Re: emonTH_DHT22_DS18B20 compile failure

Hi,

I had already set the sketchbook location in file>preferences. It's not the problem. I can see some sketches in "File->Sketchbook/OpenEnergyMonitor/..." but not all.  I can only see ino files that are store in a parent folder named with the same name.

As an example, I can see 'emonTH_DHT22_DS18B20.ino' that is in the folder

'./sketchbook/OpenEnergyMonitor/emonTH/emonTH_DHT22_DS18B20/'

 

I can't see 'temperature_search.ino' that is in the folder

'./sketchbook/OpenEnergyMonitor/emonTH/Simple emonTH Sensor Test/emonTH_temperature_search.

Arduino IDE ask me to move it to

'./sketchbook/OpenEnergyMonitor/emonTH/Simple emonTH Sensor Test/emonTH_temperature_search/'temperature_search/

 

By the way, it's not a big deal compared the compilation issue described above (main subject of that thread)

Is there any user of Arduino IDE on Ubuntu facing the same bug ?

 

 

 

Robert Wall's picture

Re: emonTH_DHT22_DS18B20 compile failure

Yes, I am using Arduino 1.0.5 on Ubuntu 12.04 and I don't have any problems. My "OpenEnergy" directory is a subdirectory of my Home Folder, and below that my directory structure is essentially the same as the Windows 8.1 section here: http://openenergymonitor.org/emon/buildingblocks/installing-arduino-libr...

I don't use Git to manage the downloads though.

efidi13's picture

Re: emonTH_DHT22_DS18B20 compile failure

Hi,

me too I'm facing a compile failure even if it's different from the one described above.

I made a new installation of arduino, emonlib (git cloned) on Debian 7. The setup should be correct as this is not the first time I setup the arduino environment with emon stuff.

In my case I have the following error compiling whatever emonTx sketch (well, I just tried some of them):

 

In file included from /home/my_user/sketchbook/libraries/jeelib/JeeLib.h:19,
                 from emonTx_CT123_Voltage.ino:54:
/home/my_user/sketchbook/libraries/jeelib/RF69.h:10: error: expected ‘,’ or ‘...’ before numeric constant

 

I have the same result with both the arduino package installed from Debian repos (1.0.1) and with Arduino 1.0.5.

On github I see that jeelib/RF69.h has been checked-in 2 days ago. Trying to compile the RF12demo example provided along with the jeelib library everything works fine.

Any idea?

Regards,

Federico.

Robert Wall's picture

Re: emonTH_DHT22_DS18B20 compile failure

JeeLib downloaded 5 minutes ago works for me on the emonTH file mentioned at the top of this thread, but I get the same error with the emonTx V2 sketch. Federico, which sketches (as well as that one) are giving you problems?

At first sight, it appears to be a library conflict.

EDIT:

It's a naming conflict, "freq" is what it's objecting to. I have not yet tracked it down, the immediate work-around is in both RF69.h and RF69.cpp, change the name of the parameter "freq" to "f" (or whatever you wish).

EDIT 2:

In the basic sketch "emonTx_CT123_Voltage.ino", on line 47, we have:

#define freq RF12_433MHZ

and in RF12.h we have:

#define RF12_433MHZ     1   ///< RFM12B 433 MHz frequency band.
#define RF12_868MHZ     2   ///< RFM12B 868 MHz frequency band.
#define RF12_915MHZ     3   ///< RFM12B 915 MHz frequency band.

so when the sketch goes through the preprocessor, "freq" is replaced by the numeric constant "1" (or "2" or "3"). You can't have a numeric constant as the name of a parameter into a function, which is why it is objecting in RF69.h

The long-term solution is to rename "freq" inside all the emon sketches. It would probably be a good idea to follow convention and use "FREQ" instead.

Eric_AMANN's picture

Re: emonTH_DHT22_DS18B20 compile failure

I migrated from Arduino IDE 1.0 to 1.5.5 and it solved my two problems :

   - the compilation bug evoked at the beginning of that thread: "Could not convert ‘Serial’ to ‘bool’" ..

   - the naming issue that i tried to described above

I also manage to compile the TX V2 sketch named "EmonTx_CT123_Voltage without any problem.

Regards,

Eric

glyn.hudson's picture

Re: emonTH_DHT22_DS18B20 compile failure

Thanks for the heads up regarding the naming issue on the new JeeLib, I've changed 'freq' to RF_freq to fix the issue. Changes have been pushed to Git: https://github.com/openenergymonitor/emonTxFirmware/

efidi13's picture

Re: emonTH_DHT22_DS18B20 compile failure

Hi,

sorry for my late feedback.

Robert, thank you for debugging the issue and thanks to Glyn too for the quick workaround.

Now everything works fine.

Best regards,

Federico.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.