pull/113/head
alanbjohnston 5 years ago committed by GitHub
parent b38e528681
commit 8f7cc9afe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,9 +53,9 @@ if __name__ == "__main__":
# optional : change voltage range to 16V # optional : change voltage range to 16V
ina219.bus_voltage_range = BusVoltageRange.RANGE_16V ina219.bus_voltage_range = BusVoltageRange.RANGE_16V
except: except:
print("Error 2", file=sys.stderr) print("Error 2", file=sys.stderr, flush=True)
except: except:
print("Error 1", file=sys.stderr) print("Error 1", file=sys.stderr, flush=True)
# No try checking yet # No try checking yet
i2c_one = I2C(buses[0]) i2c_one = I2C(buses[0])
@ -66,6 +66,7 @@ if __name__ == "__main__":
ina219_one = INA219(I2C(1), 0x4a) ina219_one = INA219(I2C(1), 0x4a)
else: else:
ina219_one = INA219(i2c_one, addresses[0]) ina219_one = INA219(i2c_one, addresses[0])
try:
ina219_two = INA219(i2c_one, addresses[1]) ina219_two = INA219(i2c_one, addresses[1])
ina219_three = INA219(i2c_one, addresses[2]) ina219_three = INA219(i2c_one, addresses[2])
ina219_four= INA219(i2c_one, addresses[3]) ina219_four= INA219(i2c_one, addresses[3])
@ -73,8 +74,10 @@ if __name__ == "__main__":
ina219_six = INA219(i2c_two, addresses[1]) ina219_six = INA219(i2c_two, addresses[1])
ina219_seven = INA219(i2c_two, addresses[2]) ina219_seven = INA219(i2c_two, addresses[2])
ina219_eight = INA219(i2c_two, addresses[3]) ina219_eight = INA219(i2c_two, addresses[3])
except:
print("Error 3", file=sys.stderr, flush=True)
while (True): while (True):
try:
# print("{:6.3f} ".format(0), "{:6.3f} ".format(0)) # print("{:6.3f} ".format(0), "{:6.3f} ".format(0))
print("{:6.3f} ".format(ina219_one.bus_voltage), "{:6.3f} ".format(ina219_one.current) , end = '') print("{:6.3f} ".format(ina219_one.bus_voltage), "{:6.3f} ".format(ina219_one.current) , end = '')
print("{:6.3f} ".format(ina219_two.bus_voltage), "{:6.3f} ".format(ina219_two.current) , end = '') print("{:6.3f} ".format(ina219_two.bus_voltage), "{:6.3f} ".format(ina219_two.current) , end = '')
@ -84,7 +87,8 @@ if __name__ == "__main__":
print("{:6.3f} ".format(ina219_six.bus_voltage), "{:6.3f} ".format(ina219_six.current) , end = '') print("{:6.3f} ".format(ina219_six.bus_voltage), "{:6.3f} ".format(ina219_six.current) , end = '')
print("{:6.3f} ".format(ina219_seven.bus_voltage), "{:6.3f} ".format(ina219_seven.current) , end = '') print("{:6.3f} ".format(ina219_seven.bus_voltage), "{:6.3f} ".format(ina219_seven.current) , end = '')
print("{:6.3f} ".format(ina219_eight.bus_voltage), "{:6.3f} ".format(ina219_eight.current) , end = '') print("{:6.3f} ".format(ina219_eight.bus_voltage), "{:6.3f} ".format(ina219_eight.current) , end = '')
except:
print("Error 4", file=sys.stderr, flush=True)
print(" ") print(" ")
inp = input() inp = input()
# print(inp) # print(inp)

Loading…
Cancel
Save

Powered by TurnKey Linux.