Skip to content

Commit cdadbf5

Browse files
authored
Merge pull request #1 from adafruit/lib_files
adding library, docs, example
2 parents ac9822d + 7ea9340 commit cdadbf5

File tree

6 files changed

+437
-18
lines changed

6 files changed

+437
-18
lines changed

README.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,23 @@ Usage Example
9292
=============
9393

9494
.. code-block:: python
95+
96+
import time
97+
import board
9598
import adafruit_ina228
9699
100+
i2c = board.I2C()
101+
ina228 = adafruit_ina228.INA228(i2c)
102+
103+
while True:
104+
print(f"Current: {ina228.current:.2f} mA")
105+
print(f"Bus Voltage: {ina228.voltage:.2f} V")
106+
print(f"Shunt Voltage: {ina228.shunt_voltage*1000:.2f} mV")
107+
print(f"Power: {ina228.power:.2f} mW")
108+
print(f"Energy: {ina228.energy:.2f} J")
109+
print(f"Temperature: {ina228.temperature:.2f} °C")
110+
time.sleep(1)
111+
97112
Documentation
98113
=============
99114
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/ina228/en/latest/>`_.

0 commit comments

Comments
 (0)