Sensirion / arduino-gas-index-algorithm

Arduino Library for Sensirion's Gas Index Algorithm, providing a VOC and NOx Index output signal calculated from the SGP40/41 raw signals
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Error while compiling exampleUsage.ino #8

Open stiamon77 opened 1 month ago

stiamon77 commented 1 month ago

Hi Error while compiling exampleUsage.ino

C:\Users\stiam\AppData\Local\Temp\.arduinoIDE-unsaved2024726-13276-1kakfg3.42te\exampleUsage\exampleUsage.ino: In function 'void setup()':
C:\Users\stiam\AppData\Local\Temp\.arduinoIDE-unsaved2024726-13276-1kakfg3.42te\exampleUsage\exampleUsage.ino:59:16: error: no matching function for call to 'SensirionI2cSht4x::begin(TwoWire&)'
   59 |     sht4x.begin(Wire);
      |     ~~~~~~~~~~~^~~~~~
In file included from C:\Users\stiam\AppData\Local\Temp\.arduinoIDE-unsaved2024726-13276-1kakfg3.42te\exampleUsage\exampleUsage.ino:37:
c:\Users\stiam\Documents\Arduino\libraries\Sensirion_I2c_SHT4x\src/SensirionI2cSht4x.h:74:10: note: candidate: 'void SensirionI2cSht4x::begin(TwoWire&, uint8_t)'
   74 |     void begin(TwoWire& i2cBus, uint8_t i2cAddress);
      |          ^~~~~
c:\Users\stiam\Documents\Arduino\libraries\Sensirion_I2c_SHT4x\src/SensirionI2cSht4x.h:74:10: note:   candidate expects 2 arguments, 1 provided

exit status 1

Compilation error: no matching function for call to 'SensirionI2cSht4x::begin(TwoWire&)'
psachs commented 1 month ago

Thanks for the report. The latest update of the Arduino SHT4x library requires to also supply the I2C address to support all version of the SHT4x sensor. You can compile the example by changing the line to

sht4x.begin(Wire, SHT40_I2C_ADDR_44);

We will update the examples within the next days to support the latest version of the SHT4x drivers.

stiamon77 commented 1 month ago

There is also a small error in the library name. exampleUsage.ino & exampleLowPowerUsage.ino

#include <SensirionI2CSht4x.h>

SensirionI2CSht4x sht4x;

it's correct like this:

#include <SensirionI2cSht4x.h>

SensirionI2cSht4x sht4x;