i prevent you, I m french so my ENglish is so so
i have bought a ADC ADS1115 and to read the analog voltage I used python langage with a raspberry,
my problem and that i receive numbers but it doesn't correspond of my voltage. It must be a probleme with byte order, so this is my code:
Code: Select all
import time
import smbus
Bus_I2C = smbus.SMBus(1)
Address_I2C_US = 0x48 #
Bus_I2C.write_word_data(Address_I2C_US,0x01,0x8384)
Bus_I2C.write_byte(Address_I2C_US,0x00)
while True:
time.sleep(1)
try:
tension=Bus_I2C.read_word_data(Address_I2C_US,0)
voltage = (tension & 0xFF) << 8 | (tension >> 8)
print(voltage)
except IOError:
print("connexion Error ")
Do you have an idea to resolve my problem?
thank you ;)