Update voltcurrent.py

pull/55/head
alanbjohnston 5 years ago committed by GitHub
parent bb1573c00d
commit d81234322a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,11 +28,10 @@ if __name__ == "__main__":
print("buses: ", buses, " addr: ", addresses) print("buses: ", buses, " addr: ", addresses)
for x in buses: for x in buses:
for y in addresses: for y in addresses:
print(x,y) # print(x,y)
# try: try:
if True:
# Create library object using Extended Bus I2C port # Create library object using Extended Bus I2C port
print("bus: ", x, " addr: ", y) # print("bus: ", x, " addr: ", y)
i2c_bus = I2C(x) # 1 Device is /dev/i2c-1 i2c_bus = I2C(x) # 1 Device is /dev/i2c-1
ina219 = INA219(i2c_bus, y) ina219 = INA219(i2c_bus, y)
@ -51,6 +50,6 @@ if __name__ == "__main__":
# INA219 measure bus voltage on the load side. So PSU voltage = bus_voltage + shunt_voltage # INA219 measure bus voltage on the load side. So PSU voltage = bus_voltage + shunt_voltage
# print("{:6.3f}".format(bus_voltage + shunt_voltage)) # print("{:6.3f}".format(bus_voltage + shunt_voltage))
print(bus_voltage, " ", current, " ") print(bus_voltage, " ", current, " ")
# except: except:
# print("0.0 Error") # print("0.0 Error)

Loading…
Cancel
Save

Powered by TurnKey Linux.