From 357e73c440cc35005986296230cb561d550f16a8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 31 May 2021 12:39:19 -0400 Subject: [PATCH] added time.sleep(0.001) after each config --- python/voltcurrent.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/voltcurrent.py b/python/voltcurrent.py index d6fca650..9994ec80 100644 --- a/python/voltcurrent.py +++ b/python/voltcurrent.py @@ -71,8 +71,11 @@ if __name__ == "__main__": try: ina219_one = INA219(i2c_one, addresses[0]) ina219_one.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_one.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_one.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) one = 1 except: # print("Python Error 3", file=sys.stderr, flush=True) @@ -80,8 +83,11 @@ if __name__ == "__main__": try: ina219_two = INA219(i2c_one, addresses[1]) ina219_two.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_two.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_two.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) two = 1 except: # print("Python Error 3", file=sys.stderr, flush=True) @@ -90,8 +96,11 @@ if __name__ == "__main__": try: ina219_three = INA219(i2c_one, addresses[2]) ina219_three.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_three.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_three.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) three = 1 except: # print("Python Error 3", file=sys.stderr, flush=True) @@ -100,8 +109,11 @@ if __name__ == "__main__": try: ina219_four= INA219(i2c_one, addresses[3]) ina219_four.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_four.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_four.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) four = 1 except: four = 0 @@ -116,8 +128,11 @@ if __name__ == "__main__": try: ina219_five = INA219(i2c_two, addresses[0]) ina219_five.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_five.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_five.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) five = 1 except: # print("Python Error 3", file=sys.stderr, flush=True) @@ -125,8 +140,11 @@ if __name__ == "__main__": try: ina219_six = INA219(i2c_two, addresses[1]) ina219_six.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_six.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_six.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) six = 1 except: # print("Python Error 3", file=sys.stderr, flush=True) @@ -134,8 +152,11 @@ if __name__ == "__main__": try: ina219_seven = INA219(i2c_two, addresses[2]) ina219_seven.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_seven.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_seven.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) seven = 1 except: # print("Python Error 3", file=sys.stderr, flush=True) @@ -143,8 +164,11 @@ if __name__ == "__main__": try: ina219_eight = INA219(i2c_two, addresses[3]) ina219_eight.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_eight.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S + time.sleep(0.001) ina219_eight.bus_voltage_range = BusVoltageRange.RANGE_16V + time.sleep(0.001) eight = 1 except: # print("Python Error 3", file=sys.stderr, flush=True)