INA219 current sensing with Arduino/genuino 101

Hello everyone, I’m working on the research sensing the current using the INA 219

I just downloaded the library by the Arduino exe → sketch → library manager → adafruit lNA 219

There’s one example for the library, so I want to compile that example code but it doesn’t work…

I don’t have idea to solve that error with simple example code…

this is the example code,

#include <Wire.h>
#include <Adafruit_INA219.h>

Adafruit_INA219 ina219;

void setup(void)
{
Serial.begin(115200);
while (!Serial) {
// will pause Zero, Leonardo, etc until serial console opens
delay(1);
}

uint32_t currentFrequency;

Serial.println(“Hello!”);

// Initialize the INA219.
// By default the initialization will use the largest range (32V, 2A). However
// you can call a setCalibration function to change this range (see comments).
if (! ina219.begin()) {
Serial.println(“Failed to find INA219 chip”);
while (1) { delay(10); }
}
// To use a slightly lower 32V, 1A range (higher precision on amps):
//ina219.setCalibration_32V_1A();
// Or to use a lower 16V, 400mA range (higher precision on volts and amps):
//ina219.setCalibration_16V_400mA();

Serial.println(“Measuring voltage and current with INA219 …”);
}

void loop(void)
{
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float power_mW = 0;

shuntvoltage = ina219.getShuntVoltage_mV();
busvoltage = ina219.getBusVoltage_V();
current_mA = ina219.getCurrent_mA();
power_mW = ina219.getPower_mW();
loadvoltage = busvoltage + (shuntvoltage / 1000);

Serial.print(“Bus Voltage: “); Serial.print(busvoltage); Serial.println(” V”);
Serial.print(“Shunt Voltage: “); Serial.print(shuntvoltage); Serial.println(” mV”);
Serial.print(“Load Voltage: “); Serial.print(loadvoltage); Serial.println(” V”);
Serial.print(“Current: “); Serial.print(current_mA); Serial.println(” mA”);
Serial.print(“Power: “); Serial.print(power_mW); Serial.println(” mW”);
Serial.println("");

delay(2000);
}

and this is an error message.

In file included from C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_SPIDevice.h:1:0,

from C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_BusIO_Register.h:2,

from C:\Userssoo-hwan\Documents\Arduino\libraries\Adafruit_INA219/Adafruit_INA219.h:21,

from C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_INA219\examples\getcurrent\getcurrent.ino:2:

C:\Users\soo-hwan\AppData\Local\Arduino15\packages\Intel\hardware\arc32\2.0.2\libraries\SPI\src/SPI.h:47:18: error: invalid conversion from ‘int’ to ‘BitOrder’ [-fpermissive]

#define MSBFIRST 1

^

C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_SPIDevice.h:31:31: note: in expansion of macro ‘MSBFIRST’

#define SPI_BITORDER_MSBFIRST MSBFIRST

^

C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_SPIDevice.h:62:43: note: in expansion of macro ‘SPI_BITORDER_MSBFIRST’

BitOrder dataOrder = SPI_BITORDER_MSBFIRST,

^

C:\Users\soo-hwan\AppData\Local\Arduino15\packages\Intel\hardware\arc32\2.0.2\libraries\SPI\src/SPI.h:47:18: error: invalid conversion from ‘int’ to ‘BitOrder’ [-fpermissive]

#define MSBFIRST 1

^

C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_SPIDevice.h:31:31: note: in expansion of macro ‘MSBFIRST’

#define SPI_BITORDER_MSBFIRST MSBFIRST

^

C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_SPIDevice.h:67:43: note: in expansion of macro ‘SPI_BITORDER_MSBFIRST’

BitOrder dataOrder = SPI_BITORDER_MSBFIRST,

^

C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_INA219\examples\getcurrent\getcurrent.ino: In function ‘void setup()’:

C:\Users\soo-hwan\Documents\Arduino\libraries\Adafruit_INA219\examples\getcurrent\getcurrent.ino:15:12: warning: unused variable ‘currentFrequency’ [-Wunused-variable]

exit status 1
보드 Arduino/Genuino 101 compile errors

please help me and thank you!!

This is related question before, now I found that the library header file from https://github.com/adafruit/Adafruit_INA219 isn't compatible with the arduino/genuino 101 board. (I used intel curienano for bluetooth communication and light weight)

I wonder there's any example code using INA219 with intel curienano.

I think the address of the code may be the problem..

thank you!

Topics merged

Why did you start a second topic rather than continuing the original one ?

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a timeout from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky “How to use this forum - please read.” post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless