GY-63_MS5611/libraries/INA226/examples/INA226_demo/INA226_demo.ino

49 lines
845 B
Arduino
Raw Normal View History

2021-05-30 08:22:31 -04:00
//
// FILE: INA226_demo.ino
// AUTHOR: Rob Tillaart
2021-06-22 14:38:00 -04:00
// VERSION: 0.1.2
2021-05-30 08:22:31 -04:00
// PURPOSE: demo
// DATE: 2021-05-18
// URL: https://github.com/RobTillaart/INA226
#include "INA226.h"
#include "Wire.h"
INA226 INA(0x40);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
if (!INA.begin() )
{
Serial.println("could not connect. Fix and Reboot");
}
2021-06-22 09:22:35 -04:00
INA.setMaxCurrentShunt(1, 0.002);
2021-05-30 08:22:31 -04:00
}
void loop()
{
2021-06-22 14:38:00 -04:00
Serial.println("\nBUS\tSHUNT\tCURRENT\tPOWER");
for (int i = 0; i < 20; i++)
{
Serial.print(INA.getBusVoltage(), 3);
Serial.print("\t");
Serial.print(INA.getShuntVoltage_mV(), 3);
Serial.print("\t");
Serial.print(INA.getCurrent_mA(), 3);
Serial.print("\t");
Serial.print(INA.getPower_mW(), 3);
Serial.println();
delay(1000);
}
2021-05-30 08:22:31 -04:00
}
// -- END OF FILE --