File tree 1 file changed +11
-8
lines changed 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change
1
+ """Sample code and test for adafruit_in219"""
2
+
1
3
import time
2
4
import board
3
- from adafruit_ina219 import *
5
+ from adafruit_ina219 import ADCResolution , BusVoltageRange , INA219
6
+
4
7
5
8
i2c_bus = board .I2C ()
6
9
9
12
print ("ina219 test" )
10
13
11
14
# display some of the advanced field (just to test)
12
- print ( "Config register:" )
13
- print ( " bus_voltage_range: 0x%1X" % ina219 .bus_voltage_range )
14
- print ( " gain: 0x%1X" % ina219 .gain )
15
- print ( " bus_adc_resolution: 0x%1X" % ina219 .bus_adc_resolution )
16
- print ( " shunt_adc_resolution: 0x%1X" % ina219 .shunt_adc_resolution )
17
- print ( " mode: 0x%1X" % ina219 .mode )
18
- print ("" )
15
+ print ("Config register:" )
16
+ print (" bus_voltage_range: 0x%1X" % ina219 .bus_voltage_range )
17
+ print (" gain: 0x%1X" % ina219 .gain )
18
+ print (" bus_adc_resolution: 0x%1X" % ina219 .bus_adc_resolution )
19
+ print (" shunt_adc_resolution: 0x%1X" % ina219 .shunt_adc_resolution )
20
+ print (" mode: 0x%1X" % ina219 .mode )
21
+ print ("" )
19
22
20
23
# optional : change configuration to use 32 samples averaging for both bus voltage and shunt voltage
21
24
ina219 .bus_adc_resolution = ADCResolution .ADCRES_12BIT_32S
You can’t perform that action at this time.
0 commit comments