Hello
I have a python program in my raspberry.
from periphery import I2C
def get_adc_value():
# Open i2c-1 controller
i2c = I2C("/dev/i2c-1")
msgs = [I2C.Message([0x61]), I2C.Message([0x00,0x00], read=True)]
i2c.transfer(0x36, msgs)
adc_value = (msgs[1].data[0] & 0x0F) <<8 | (msgs[1].data[1])
# ATTENTION le 4.93 est la tension de ref mesurée à la main
# pas utile en mode ratiometrique
adc_value_volt=(adc_value*4.93/4096)
print("ADC VALUE P4.2: 0x{:04x} , {:0.2f}V".format(adc_value,adc_value_volt))
msgs = [I2C.Message([0x63]), I2C.Message([0x00,0x00], read=True)]
i2c.transfer(0x36, msgs)
adc_value = (msgs[1].data[0] & 0x0F) <<8 | (msgs[1].data[1])
adc_value_volt=(adc_value*4.93/4096)
print("ADC VALUE P6.2: 0x{:04x} , {:0.2f}V".format(adc_value,adc_value_volt))
i2c.close()
I want to integrate this function in my node red in order to have only one point of debug.
Can you tell me how to do it?
Thank You