@@ -67,7 +67,7 @@ void setup() { //
67
67
// The begin initializes the calibration for an expected ±1 Amps maximum current and for a 0.1Ohm resistor, and //
68
68
// since no specific device is given as the 3rd parameter all devices are initially set to these values //
69
69
devicesFound = INA226.begin (1 ,100000 ); // Set expected Amps and resistor //
70
- Serial.print (F (" Detected " )); // //
70
+ Serial.print (F (" - Detected " )); // //
71
71
Serial.print (devicesFound); // //
72
72
Serial.println (F (" INA226 devices on I2C bus" )); // //
73
73
INA226.setAveraging (4 ); // Average each reading n-times //
@@ -80,6 +80,7 @@ void setup() { //
80
80
** run in a simple infinite loop **
81
81
*******************************************************************************************************************/
82
82
void loop () { // Main program loop //
83
+ static uint16_t loopCounter = 0 ; // Count the number of iterations //
83
84
for (uint8_t i=0 ;i<devicesFound;i++) { // Loop through all devices found //
84
85
Serial.print (F (" Bus voltage " )); // //
85
86
Serial.print (i+1 ); // //
@@ -97,8 +98,10 @@ void loop() { //
97
98
Serial.print (i+1 ); // //
98
99
Serial.print (F (" : " )); // //
99
100
Serial.print ((float )INA226.getBusMicroWatts (i)/1000.0 ,4 ); // Convert to milliwatts //
100
- Serial.println (F (" mW" )); // //
101
- Serial.println (); // //
101
+ Serial.print (F (" mW\n\n " )); // //
102
102
} // of for-next each device loop // //
103
- delay (1000 ); // //
103
+ delay (5000 ); // Wait 5 seconds for next reading //
104
+ Serial.print (F (" Loop iteration " ) ); // //
105
+ Serial.print (++loopCounter); // //
106
+ Serial.print (F (" \n\n " ) ); // //
104
107
} // of method loop //----------------------------------//
0 commit comments