Hello all,
I read all the I2C related posts but still can't fully understand how to send dada from PIC18F to an Arduino.
I set the address of arduino to 0x26 and try to do following in PicBasic but I don't get any data:
Code:
TRISC.0 = 0
TRISB = 000000
LED VAR PORTC.0 ' Assign name "LED" to PORTC.0
SCL VAR PORTB.3 ' Clock pin
SDA VAR PORTB.1 ' Data pin
ADDR VAR WORD
ADDR = $26 ' I2C address
mainloop:
HIGH LED ' Turn on LED connected to PORTB.0
Pause 1000 ' Delay for 1 seconds
I2CWrite SDA,SCL,ADDR,[0]
LOW LED ' Turn off LED connected to PORTB.0
Pause 1000 ' Delay for 1 seconds
Goto mainloop ' Go back to loop and blink LED forever
Any idea?
Bookmarks