geeekpi/upsv3

0.0 for all readings

Closed this issue · 1 comments

If I run the code from the demo.py file, it returns 0.0 for all readings. What can I do?

from ina219 import INA219, DeviceRangeError
SHUNT_OHMS = 0.05
"""Define method to read information from coulometer."""
ina = INA219(SHUNT_OHMS, busnum=1, address=0x40)
ina.configure()
voltage_v = ina.voltage()
current_mA = ina.current()
power_mW = ina.power()
shunt_voltage_mV = ina.shunt_voltage()

I can see the UPS detected at 0x40 from the Raspberrypi with i2cdetect -y 1
Thanks for the help

you should add print() part, it just assigned result to the variable and did not display,
you can add a loop to display the result.

while True:
     print("Current_mA: {}, Current_Voltage: {}". format(current_mA,voltage_v )