2017-09-12, 09:02 AM
(This post was last modified: 2017-09-12, 09:05 AM by Alpenskipper.)
I ordered the automation phat, and I am now trying to figure out, how to implement it in OP.
The automation phat is connected via I2C and after installing a library, the battery is connected to the analog input. It measures up to 24V directly.
The voltage is shown as follows:
value = automationhat.analog.one.read()
How could the voltage data be shown in OP? The aim is to send it via MQTT.
Martin
Edit: Just found a python example, but I need it simpler :-)
#!/usr/bin/env python
import time
import automationhat
time.sleep(0.1) # short pause after ads1015 class creation recommended
print("""
Press CTRL+C to exit.
""")
while True:
value = automationhat.analog.one.read()
print(value)
time.sleep(0.25)
The automation phat is connected via I2C and after installing a library, the battery is connected to the analog input. It measures up to 24V directly.
The voltage is shown as follows:
value = automationhat.analog.one.read()
How could the voltage data be shown in OP? The aim is to send it via MQTT.
Martin
Edit: Just found a python example, but I need it simpler :-)
#!/usr/bin/env python
import time
import automationhat
time.sleep(0.1) # short pause after ads1015 class creation recommended
print("""
Press CTRL+C to exit.
""")
while True:
value = automationhat.analog.one.read()
print(value)
time.sleep(0.25)