-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- improve RP2040 support - add address test in isConnected() - update readme.md - add array example
- Loading branch information
1 parent
c5ed715
commit 7e9220a
Showing
7 changed files
with
124 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// FILE: INA219_array.ino | ||
// AUTHOR: Rob Tillaart | ||
// PURPOSE: demo array of INA219 sensors | ||
// URL: https://github.com/RobTillaart/INA219 | ||
|
||
|
||
#include "INA219.h" | ||
#include "Wire.h" | ||
|
||
INA219 INA(0x40); | ||
|
||
INA219 arr_ina[3] = { INA219(0x40), INA219(0x41), INA219(0x42) }; | ||
|
||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
Serial.print("INA219_LIB_VERSION: "); | ||
Serial.println(INA219_LIB_VERSION); | ||
|
||
Wire.begin(); | ||
|
||
for (int i = 0; i < 3; i++) | ||
{ | ||
if (! arr_ina[i].begin()) | ||
{ | ||
Serial.print("Could not connect: "); | ||
Serial.print(i); | ||
Serial.println(". Fix and Reboot"); | ||
} | ||
} | ||
|
||
for (int i = 0; i < 3; i++) | ||
{ | ||
arr_ina[i].setMaxCurrentShunt(5, 0.002); | ||
delay(1000); | ||
Serial.println(arr_ina[i].getBusVoltageRange()); | ||
} | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
Serial.println("\n\t#\tBUS\t\tSHUNT\t\tCURRENT\t\tPOWER\t\tOVF\t\tCNVR"); | ||
for (int i = 0; i < 3; i++) | ||
{ | ||
Serial.print("\t"); | ||
Serial.print(i); | ||
Serial.print("\t"); | ||
Serial.print(arr_ina[i].getBusVoltage(), 2); | ||
Serial.print("\t\t"); | ||
Serial.print(arr_ina[i].getShuntVoltage_mV(), 2); | ||
Serial.print("\t\t"); | ||
Serial.print(arr_ina[i].getCurrent_mA(), 2); | ||
Serial.print("\t\t"); | ||
Serial.print(arr_ina[i].getPower_mW(), 2); | ||
Serial.print("\t\t"); | ||
Serial.print(arr_ina[i].getMathOverflowFlag()); | ||
Serial.print("\t\t"); | ||
Serial.print(arr_ina[i].getConversionFlag()); | ||
Serial.println(); | ||
delay(1000); | ||
} | ||
delay(1000); | ||
} | ||
|
||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=INA219 | ||
version=0.1.3 | ||
version=0.1.4 | ||
author=Rob Tillaart <[email protected]> | ||
maintainer=Rob Tillaart <[email protected]> | ||
sentence=Arduino library for INA219 voltage, current and power sensor. | ||
|