Hello, I am just a beginner with i2c
So I am trying to make communication with i2c between two PICAXE chips. (08M2 as Master and 28X2 as Slave.)
I think that I have some wrong with my two codes.
so that's the Master's code, and yes it has a button to send message to light up an LED on the other chip (28X2).
And this is slave's code.
So my idea was that, when pin 4 (on master) is high then it turns on the LED on slave. And pin 3 to turn off LED.
My wiring should be fine. I have two 4k7 pull-up resistors on SCL & SDA.
So hopefully you understood my english.
Thanks.
So I am trying to make communication with i2c between two PICAXE chips. (08M2 as Master and 28X2 as Slave.)
I think that I have some wrong with my two codes.
Code:
main:
hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
do
if pinC.3 = 1 then
pause 500
hi2cout 0, ( 2 )
endif
if pinC.4 = 1 then
pause 500
hi2cout 0, ( 3 )
endif
loop
stop
Code:
symbol varA = w0
main:
hi2csetup i2cslave, %10100000
do
hi2cin 0, ( varA )
if varA = 3 then
high C.0
endif
if varA = 2 then
low C.0
endif
loop
stop
So my idea was that, when pin 4 (on master) is high then it turns on the LED on slave. And pin 3 to turn off LED.
My wiring should be fine. I have two 4k7 pull-up resistors on SCL & SDA.
So hopefully you understood my english.
Thanks.