Hi all,
I am trying to set-up a 20X2 as an I2C slave, reading an analogue value string (reading a potentiometer) it and transmitting the value over an I2C network (to a 28X2)
All I get is 161, regardless of the potentiometer position on 20X2
Can someone help?
Master Code
#picaxe 28x2
init:
hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
Read_Data:
hi2cin 0,(b0)
pause 100
sertxd ("Read From Slave",cr,lf)
sertxd (#b0,cr,lf)
goto Read_Data
Slave Code
#picaxe 20x2
init:
hi2csetup i2cslave, %10100000
main:
readadc b.0,b0
pause 100
put 0,b0
goto main
I am trying to set-up a 20X2 as an I2C slave, reading an analogue value string (reading a potentiometer) it and transmitting the value over an I2C network (to a 28X2)
All I get is 161, regardless of the potentiometer position on 20X2
Can someone help?
Master Code
#picaxe 28x2
init:
hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
Read_Data:
hi2cin 0,(b0)
pause 100
sertxd ("Read From Slave",cr,lf)
sertxd (#b0,cr,lf)
goto Read_Data
Slave Code
#picaxe 20x2
init:
hi2csetup i2cslave, %10100000
main:
readadc b.0,b0
pause 100
put 0,b0
goto main