AM2315 compile error on electron

Does the Adafruit_AM2315 library not work with the Electron? It seems to be having a problem with Wire. This is the error I am getting:

Adafruit_AM2315/Adafruit_AM2315.cpp: In member function 'bool Adafruit_AM2315::begin()':

Adafruit_AM2315/Adafruit_AM2315.cpp:35:3: error: 'Wire' was not declared in this scope
   Wire.begin();
   ^

The library needs some updating to get it working with electron. It’s just a conditional that the library porter has written.

If you want to use it, you can copy the content from .h and .cpp and make the change in the .cpp file by removing

#if (PLATFORM_ID == 6)
  #define PHOTON
#endif

#ifdef PHOTON
  #include "application.h"
#endif

and change to

#ifdef PARTICLE
  #include "application.h"
#endif

I will send in the fix to the library repo later :slight_smile:

UPDATE - Sent in a fix here: https://github.com/tripzero/Adafruit_AM2315/pull/1

1 Like