-
Notifications
You must be signed in to change notification settings - Fork 19
Home
Chris Borrill edited this page May 17, 2018
·
1 revision
Example for Official esp8266 port of Micropython.
from machine import Pin, I2C
from ina219 import INA219
from logging import INFO
SHUNT_OHMS = 0.1
i2c = I2C(-1, Pin(17), Pin(16))
ina = INA219(SHUNT_OHMS, i2c, log_level=INFO)
ina.configure()
print("Bus Voltage: %.3f V" % ina.voltage())
print("Current: %.3f mA" % ina.current())
print("Power: %.3f mW" % ina.power())
Example for Official esp32 port of Micropython.
from machine import Pin, I2C
from ina219 import INA219
from logging import INFO
SHUNT_OHMS = 0.1
i2c = I2C(-1, Pin(17), Pin(16))
ina = INA219(SHUNT_OHMS, i2c, log_level=INFO)
ina.configure()
print("Bus Voltage: %.3f V" % ina.voltage())
print("Current: %.3f mA" % ina.current())
print("Power: %.3f mW" % ina.power())