I2C troubles


Author Message
georgestheking
Newbie

Joined: 21/12/2021
Location: Belgium
Posts: 32
Posted: 10:31am 21 Jan 2022      

Hi,

I make this to read a GY-26 compass :

REM-------------------------
REM PICOMITE 5.0703  
REM -----------------------

option default integer
option explicit

DIM INTEGER RDATA(8)

SETPIN GP2,GP3, I2C2

sub compass

I2C2 OPEN 100, 1000
I2C2 WRITE &HE0, 0, 1, &H31 ' send read command &h31
I2C2 READ &HE1, 0, 8, RData() ' read 8 datas registers
I2C2 CLOSE

end sub

DO
compass

print rdata(0)
print rdata(1)

PAUSE 1000
LOOP

END

but i get an error : "pin not set for I2C2"

I use version 5.0703

Best regards

Georges