I tried to communicate with a temp-humid sensor from Honeywell:
But get the error: HIH61XX hih(0x27) does not name a type
I tried several things,
put int before HIH61XX hih(0x27);, but then I get the error: expected initializer before hih.
put HIH61XX hih(0x27); in the setup, same error.
What's wrong
In file included from sketch_sep30a.ino:7:0:
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:13:1: error: expected class-name before '{' token
{
^
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h: In member function 'bool HIH61XXCommander::isCommandMode() const':
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:33:39: error: 'f' was not declared in this scope
bool isCommandMode() const { return f & CommandModeFlag; }
^
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:33:43: error: 'CommandModeFlag' was not declared in this scope
bool isCommandMode() const { return f & CommandModeFlag; }
^
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h: In member function 'float HIH61XXCommander::highAlarmOn() const':
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:68:69: error: 'rawToHumidity' was not declared in this scope
float highAlarmOn() const { return rawToHumidity(highAlarmOn_Raw()); }
^
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h: In member function 'float HIH61XXCommander::highAlarmOff() const':
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:71:71: error: 'rawToHumidity' was not declared in this scope
float highAlarmOff() const { return rawToHumidity(highAlarmOff_Raw()); }
^
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h: In member function 'float HIH61XXCommander::lowAlarmOn() const':
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:86:67: error: 'rawToHumidity' was not declared in this scope
float lowAlarmOn() const { return rawToHumidity(lowAlarmOn_Raw()); }
^
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h: In member function 'float HIH61XXCommander::lowAlarmOff() const':
C:\Users\John\Documents\Arduino\libraries\HIH61XXCommander/HIH61XXCommander.h:89:69: error: 'rawToHumidity' was not declared in this scope
float lowAlarmOff() const { return rawToHumidity(lowAlarmOff_Raw()); }
^
sketch_sep30a.ino: In function 'void setup()':
sketch_sep30a.ino:15:13: error: expected initializer before 'hih'
sketch_sep30a.ino: In function 'void loop()':
sketch_sep30a.ino:35:5: error: 'hih' was not declared in this scope
Multiple libraries were found for "AsyncDelay.h"
John_Pijnappel:
Bibliotheek HIH61xx in map: C:\Users\John\Documents\Arduino\libraries\HIH61xx wordt gebruikt
That your library is in a folder named HIH61xx. But the folder from the download linked off that Playground page is in a folder named HIH61XX. This makes me think you're doing something weird. Either you found that library somewhere else that you didn't tell us about or else you messed with it. Not good.
So I fixed the filename in the #include directive:
#include <HIH61XX.h>
Then I got this error:
In file included from sketch_oct01a.ino:4:0:
E:\electronics\arduino\libraries\HIH61XX/HIH61XX.h:44:8: error: 'bool HIH61XX::isRunning() const' cannot be overloaded
bool isRunning() const { return f & RunningFlag; }
^
E:\electronics\arduino\libraries\HIH61XX/HIH61XX.h:41:8: error: with 'bool HIH61XX::isRunning() const'
bool isRunning() const { return f & RunningFlag; }
^
Error compiling.
I opened the file HIH61XX.h and found that the author had two identical definitions of isRunning():
bool isRunning() const { return f & RunningFlag; }
uint8_t flags() const { return f & FlagsMask; }
bool isRunning() const { return f & RunningFlag; }
I don't know whether that was allowed back in the days when the library was written or if the author just never bothered to do the most basic test of their code.
I removed the duplicate definition and the code compiles no problem.
So my advice is to delete C:\Users\John\Documents\Arduino\libraries\HIH61xx, install the one that comes with the download from the Playground link, and then fix the error in the library and the filename in your sketch.