Using the Adafruit INA260 Current Sensor Library on Particle

Hello all,

I’ve had some time away from the Particle universe and things have changed a little since I was last here. I’m trying to use Adafruit’s INA260 library --> https://github.com/adafruit/Adafruit_INA260

However, as far as I can find there is no official porting as yet. I’ve tried to follow the firmware guidelines by building the required structure in the ‘lib’ folder, but without luck.

I’m getting this error when trying to flash the device

In file included from ./inc/application.h:95:0, from src/tDCS_User.cpp:1: ../wiring/inc/spark_wiring_arduino.h:76:0: note: this is the location of the previous definition #define SPI_HAS_TRANSACTION (1) ^ In file included from src/tDCS_User.ino:9:0: lib/Adafruit_INA260/src/Adafruit_INA260.h:21:32: fatal error: Adafruit_I2CDevice.h: No such file or directory compilation terminated. ../build/module.mk:274: recipe for target '../build/target/user/platform-12-msrc/tDCS_User.o' failed make[2]: *** [../build/target/user/platform-12-msrc/tDCS_User.o] Error 1 make[2]: Leaving directory '/firmware/user' ../../../build/recurse.mk:11: recipe for target 'user' failed make[1]: *** [user] Error 2 make[1]: Leaving directory '/firmware/modules/argon/user-part' ../build/recurse.mk:11: recipe for target 'modules/argon/user-part' failed make: *** [modules/argon/user-part] Error 2 Flash device failed: Compiler encountered an error

Any suggestions would be awesome!

Thanks,

@Sammy_Herring, it seems that the Adafruit_INA260 library also the Adafruit_busIO library to work. Messy if you ask me. I have INA260_test.ino and associated library files compiling as a Web IDE app with tabs. I compiled targeting an Argon with DeviceOS v1.5.0. Here is my share:

https://go.particle.io/shared_apps/5e95cea10c54d8002117889a

Let me know if this works for you.

5 Likes

Hi @peekay123,

Thank you for making up the demo for me in the Web IDE!

I flashed it to my device and it worked first time. I forked your test and pulled the files into the /src and it worked in Visual Code. I didn’t know it needed the busIO library - I do agree, it is rather messy. But should be workable now!

I’ve got it setup with an OLED display and outputting the values to the Particle Cloud Variables.

Thanks!

Sam

P.S. You first helped me in October 2016 - thank you for still being here! (Adafruit OLED SSD1306 0.96" 128x64)

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.