I just compiled the sketch you mentioned and I did not get any errors, but in the code state that error 998 is displayed if there is no sensor is detected, make sure you have connected the sensor to the right pins and that it works properly. You can check how the sensor behaves if you have a logic analyzer or an oscilloscope.
Thank you for helping.
I checked the connection of pins and voltages, however, It looks there is no problem.
Unfortunately, I don't have Logic Analyzer and Oscilloscope.
I also tested MPL3115A2 Pressure sensor on same shield.
It returns 999 CRC error code.
It means Edison can detect the device, but connection is not correct, right?
Is there the way to check I2C communication by another method?
Thank You and Best Regards,
I connected to an htu21d breakout board to the Edison-Arduino board but without using the Arduino SDK. The C command line code is at htu21dflib. The program first uses a shell script to configure A4/A5 for I2C using information at EmutexLabs.The C program then uses /dev/i2c-6 as usual. Temperature and humidity results match the results when using the same sensor on an Uno.
i2cdetect -r -y 6 fails to detect the sensor even though the C code works. I have not been successful using the same sensor using node.js. I suspect these two issues may be related.
- htu21d VIN <-> Edison 5V
- htu21d GND <-> Edison GND
- htu21d SDA <-> Edison A4
- htu21d SCL <-> Editson A5
Linux edison1 3.10.17-poky-edison+ #1 SMP PREEMPT Fri Jan 30 14:16:35 CET 2015, firmware 120
P.S. The Arduino code in the original post works on the Edison using Arduino SDK 1.5.3-Intel.1.0.4.
The Adafruit HTU21DF library also works but one change is required to compile. The compiler complains it cannot find the include file <util/delay.h>. Commenting out the #include statement works.