Compilation errors LibHumidity and LibTempTMP421

Questions about Modern Device and JeeLabs Sensors
DaveW
Posts: 5
Joined: Wed May 09, 2012 11:52 am

Compilation errors LibHumidity and LibTempTMP421

Post by DaveW »

I just purchased the MD0530 temperature/humidity sensor and the MD0545 temperature sensor. I downloaded the sample code from GITHUB to the Arduino 1.0.1 IDE, but when I try to compile the code to upload to an Arduino Uno from my mac I get errors.

For MD0530 I get 'LibHumidity' does not name a type.
For MD0545 I get 'LibTempTMP421' does not name a type.

Does anyone have an idea what could be causing this and how to fix it?

-DaveW

DaveW
Posts: 5
Joined: Wed May 09, 2012 11:52 am

Re: Compilation errors LibHumidity and LibTempTMP421

Post by DaveW »

I just noticed that someone posted the same issue on the Adafruit forum as I just posted here, and they haven't found an answer over there yet either. Wonder if this is related to the new 1.0.1 version of the IDE.

My directory structure is as follows for each of the libraries:

/Users/dave/Documents/Arduino/LibHumidity/LibHumidity.h (the LibHumidity.cpp file is also in this directory)

/Users/dave/Documents/Arduino/moderndevice-LibTempTMP421-8458187/LibTempTMP421.h (the LibTempTMP421.cpp is also in this directory)

-DaveW

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

DaveW,

It looks Arduino is not finding the file in your libraries folder. You may need to move the files around in the heirarchy a bit - try moving them outside of the enclosing folder they unpacked in.

I'm out of the office for a week or so - so it will be a bit before I can test this with the appropriate hardware. I do think you're just dealing with a path issue though.

Paul

DaveW
Posts: 5
Joined: Wed May 09, 2012 11:52 am

Re: Compilation errors LibHumidity and LibTempTMP421

Post by DaveW »

Paul,

Thanks for the reply. Through some trial and error I think I have identified the problem. When I download the temperature sensor library from GitHub to my macintosh its comes down as a folder labeled:

moderndevice-LibTempTMP421-8458187

I put this folder in my Arduino/libraries/ folder, as instructed, so that my directory structure became:

/Users/dave/Documents/Arduino/libraries/moderndevice-LibTempTMP421-8458187.

When I tried to compile the GetLocalTemperature sketch in this folder it couldn't find the TMP421 library because it's name is apparently supposed to be shortened to LibTempTMP421 after it is placed in the libraries folder. There are no instructions on either the Modern Devices or GitHub websites that tell the user that the name of the folder must be renamed to LibTempTMP421. As I was trying to discover the problem I renamed the folder to TMP421, in parallel with other folders that I have in my libraries folder (e.g., BMP085, RTCLib, SD, Sensiron, etc), but that didn't work. It would be very useful to newbies if the instructions on how to rename the library after downloading it were posted somewhere, as this would eliminate the problem. Perhaps it is posted somewhere and I just missed it.

The problem with getting the GetRelativeHumidity sketch to compile was that I placed the LibHumidity folder in the Arduino/ folder rather than in the Arduino/libraries/ subfolder.

Anyway, both sketches are now running. The error message generated by the compiler was not understandable to a newbie, as one doesn't know what to do with " 'LibHumidity' does not name a type' ". Thanks again for your help.

DaveW

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

Those compiler errors do leave a lot of room for improvement.
Plenty of users have offered to improve them. Unfortunately David Mellis, the big kahuna behind what gets added to the Arduino software software is so hard to work with, that nothing ever seems to get done with a lot of these offers of help.

But to the software's defense, writing software compiler messages is really hard.
How does the compiler know that the problem is a missing library? Maybe it could just spit out a list of possible things to check, in the interests of being "newbie friendly".

Paul

ruben
Posts: 5
Joined: Mon Feb 11, 2013 7:28 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by ruben »

Strange because I am getting the following errors when trying to compile the example with arduino 1.0.1
Any thoughts?

\arduino-1.0.1\libraries\LibHumidity\LibHumidity.cpp: In member function 'uint16_t LibHumidity::readSensor(uint8_t)':
\arduino-1.0.1\libraries\LibHumidity\LibHumidity.cpp:123: error: 'class TwoWire' has no member named 'send'
\arduino-1.0.1\libraries\LibHumidity\LibHumidity.cpp:124: error: 'delay' was not declared in this scope
\arduino-1.0.1\libraries\LibHumidity\LibHumidity.cpp:133: error: 'class TwoWire' has no member named 'receive'
\arduino-1.0.1\libraries\LibHumidity\LibHumidity.cpp:134: error: 'class TwoWire' has no member named 'receive'

ruben
Posts: 5
Joined: Mon Feb 11, 2013 7:28 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by ruben »

could it be because I am using a mega 2560 and not an uno?

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

I'll see if we can get this up and running on a Mega and find the issue. Maybe some referenced library broke.

Switch the board (in the tools menu) and see if it compiles - I don't think it will from the messages.

Paul

ruben
Posts: 5
Joined: Mon Feb 11, 2013 7:28 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by ruben »

Your suspicion is correct. It still does not compile when I've changed the board to UNO.
Thanks for taking a look at this.

ruben
Posts: 5
Joined: Mon Feb 11, 2013 7:28 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by ruben »

Not to badger you Paul but did you make any headway? Is there a recommended workaround?

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

Shoot - I could swear I had updated the forum, but apparently not.
New code is on the product page, updated for Arduino 1.0.
http://shop.moderndevice.com/products/h ... ure-sensor

I also remember doing this much earlier but apparently never posted the code to the website.

Thanks for badgering me.

Paul

mkin
Posts: 5
Joined: Sat Aug 03, 2013 5:30 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by mkin »

Dear Paul,
I m running Arduino 1.0.5 and I got your last code from http://shop.moderndevice.com/products/h ... ure-sensor

but I`m still getting error:

/LibHumidity.cpp: In member function 'uint16_t LibHumidity::readSensor(uint8_t)':
/LibHumidity.cpp:124: error: 'class TwoWire' has no member named 'write'
/LibHumidity.cpp:134: error: 'class TwoWire' has no member named 'read'
/LibHumidity/LibHumidity.cpp:135: error: 'class TwoWire' has no member named 'read'

please can you help me with that?

thank you very much
michael

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

Try the versions on GitHub and see if they work. https://github.com/moderndevice?tab=repositories

I'll check when I get to office on Monday - but I'd appreciate an email or a post here to let me know if the GitHub libraries get the job done.

Thanks,

Paul

mkin
Posts: 5
Joined: Sat Aug 03, 2013 5:30 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by mkin »

Thank you...

I checked the link, but it seems it is broken...
https://github.com/moderndevice/LibHumidity-MD

thank you for you help
greetings
michael

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

michael,

I just checked both files and re-uploaded to github. I did find an empty folder where I thought the files should be so something went wrong in a transfer that I never found out about.

Try them out and let me know your results. I was using 1.0.4 so it's also possible the Arduino guys broke something on latest go round, but I doubt it from the chatter on the developers forum. The new releases are mostly about supporting new (official) boards now.

Paul

mkin
Posts: 5
Joined: Sat Aug 03, 2013 5:30 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by mkin »

Hi Paul,
I m sorry, it still does'n t work. I changed the code, used Arduino 1.0.4. But it is showing me this:

GetRelativeHumidity:9: error: stray '\' in program
GetRelativeHumidity:9: error: stray '\' in program
GetRelativeHumidity.ino:310:46: error: invalid suffix "a5e02958a5820b51001f943f7fdbd68" on integer constant
GetRelativeHumidity.ino:311:62: error: invalid suffix "a5e02958a5820b51001f943f7fdbd68" on integer constant
GetRelativeHumidity:473: error: stray '#' in program
GetRelativeHumidity:473: error: stray '#' in program
GetRelativeHumidity:4: error: expected unqualified-id before '<' token
GetRelativeHumidity:473: error: expected constructor, destructor, or type conversion before '.' token
GetRelativeHumidity:473: error: expected unqualified-id before '<' token
GetRelativeHumidity:473: error: expected constructor, destructor, or type conversion before '.' token
GetRelativeHumidity:473: error: expected unqualified-id before '<' token
GetRelativeHumidity:473: error: expected unqualified-id before '<' token


I m sorry, maybe I m doing something wrong, but I remember last year it was easy, and the code and my board were working without a problem.

Let me know, if you'll have idea, where is the problem...

thanx
greetings
michal

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

What board are you using?
Compilation changes some things with various boards.
Give me the platform you are using.
Sorry this is such grief - I'll help you get to the bottom of this as soon as I hear from you.
Or maybe call the shop when you are in front of your computer and I'll try to talk you through it.

Paul

mkin
Posts: 5
Joined: Sat Aug 03, 2013 5:30 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by mkin »

Dear Paul,
I tried Arduino Duemilanove ATMEGA 328 and Arduino MEGA ADK. Using Arduino software 1.0.4 and it still gives me this:

/Users/kin/Documents/Arduino/libraries/LibHumidity/LibHumidity.cpp: In member function 'uint16_t LibHumidity::readSensor(uint8_t)':
/Users/kin/Documents/Arduino/libraries/LibHumidity/LibHumidity.cpp:124: error: 'class TwoWire' has no member named 'write'
/Users/kin/Documents/Arduino/libraries/LibHumidity/LibHumidity.cpp:134: error: 'class TwoWire' has no member named 'read'
/Users/kin/Documents/Arduino/libraries/LibHumidity/LibHumidity.cpp:135: error: 'class TwoWire' has no member named 'read'

the sensor is exactly this one:
http://moderndevice.com/product/sht21-h ... mp-sensor/

I don t know, where is the problem. Other examples / patches of other libraries works fine. Does anybody has also this problem..?
Maybe I do something wrong...

thanx for help
greetings
michael

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by oz »

Michael,

Are you using the example sketch from the library?
Examples -> LibHumidity -> GetRelativeHumdity ?

You should try making a new libary folder temporarily (Save the old one in something like "library old")
Download the library again, put it in the new library folder (Look in Arduino IDE ->File-> Preferences to see where your library folder is.

So there shouldn't be anything in the new folder except LibHumidity
Then close Arduino if it's open and reopen it.
Run the example Examples -> LibHumidity -> GetRelativeHumdity ?

And let me know your experience.

Paul

likelove
Posts: 1
Joined: Fri Sep 20, 2013 10:22 pm

Re: Compilation errors LibHumidity and LibTempTMP421

Post by likelove »

I think I have identified the problem. When I download the temperature sensor library from GitHub to my macintosh its comes down as a folder.


sbo holidayสล็อต

Post Reply