Seeed-Studio / Grove_Sunlight_Sensor

MIT License
11 stars 9 forks source link

Si115X not running on MKR WiFi 1010 #6

Open oiueei opened 1 year ago

oiueei commented 1 year ago

Hi,

I tried everything, but I couldn't get the Grove sunlight Sensor v2.0 working on my Arduino MKR 1010 with (or without) the MKR Carrier...

Please, could you help me?

sketch/SI1145DEMO.ino.cpp.o: In function `loop':
/tmp/arduino_modified_sketch_827650/SI1145DEMO.ino:27: undefined reference to `Si115X::ReadHalfWord()'
/tmp/arduino_modified_sketch_827650/SI1145DEMO.ino:29: undefined reference to `Si115X::ReadHalfWord_VISIBLE()'
/tmp/arduino_modified_sketch_827650/SI1145DEMO.ino:31: undefined reference to `Si115X::ReadHalfWord_UV()'
collect2: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta Arduino MKR WiFi 1010.

There are no problems running the Si1151 example on an Arduino UNO... Is it not running because Arduino MKR Wifi 1010 has two other i2c devices onboard?

Here is the whole story: Here is the whole story: https://forum.arduino.cc/t/si115x-not-running-on-mkr-wifi-1010/1051508

oiueei commented 1 year ago

Is this lib/sensor compatible with SAMD21-based boards like the Arduino MKR Wifi 1010?

I have no problems when I run the Si1151 demo on the Arduino UNO (Microcontroller = ATmega328P), the Glove Sunlight sensor works fine, and I can receive the measurements.

However, the same code in the Arduino MKR Wifi 1010 (Microcontroller = SAMD21) doesn't go well, and I get these errors in the compilation.

Is there an alternative to make this sensor work on the Arduino MKR Wifi 1010?

m-a-z-z-z commented 1 year ago

I was getting the same error with my Uno WiFi Rev.2. I fixed this by editing line 161 and 226 in the Si115X.cpp file. You need to add your boards microcontroller/microchip (idk which it is) to those lines, the same way it is done for the other boards.

In my case I had to add || defined(__AVR_ATmega4809__) to the end of line 161 and 226. In your case I guess it would be || defined(__SAMD21__)

Hopefully this fixes your problem if you're still looking for a solution.

mariaritafelici25 commented 1 year ago

Hi, I'm no expert but I can't get it to work either Grove Sunlight with Seeed XIAO. I tried to edit line 161 and 226 in the Si115X.cpp file. The compilation is successful but the sensor does not work. Please, could you help me?

m-a-z-z-z commented 1 year ago

I'm no expert myself unfortunately, I've had no experience with Arduino based projects before what I'm currently working on so it's hard for me to say why it's not working. Could be an issue with the sensor itself. My sunlight sensor broke in less than a month for seemingly no reason and I had to buy a new one. Maybe you got the same issue? Double check you have everything wired correctly first though and that the right board is selected in the IDE. Might also be that the microchip isn't simply defined as "(SAMD21)" and there's some prefix or suffix to it. Hope you figure it out.

mariaritafelici25 commented 1 year ago

Thank you for your reply. I tried 3 sensors and they all give problems. I just can't solve it.

mariaritafelici25 commented 1 year ago

I think I fixed it. The name to enter is defined(seeed_XIAO_m0)

gghabri commented 1 year ago

Hi,

I am working on esp8266 board. I fixed the compilation error by editing line 161 and 226 in the Si115X.cpp file by adding || defined(ESP8266). However, I got 0 for visible, IR, and UV index data.

Can you help me?

Thanks, Ghada