georgestheking Newbie
 Joined: 21/12/2021 Location: BelgiumPosts: 32 |
| Posted: 02:44pm 21 Jan 2022 |
|
|
|
Thanks to the complete team for the help,
The right code:
Rem ------------------------- Rem PICOMITE 5.0703 Rem -----------------------
Option default integer Option explicit
Dim As INTEGER RDATA(8) Dim As integer P,R
Rem COMPASS GY-26 Sub compass
SetPin GP2,GP3,I2C2
I2C2 OPEN 100,1000 I2C2 WRITE &H70,0,2,0,&H31 ' send read &h31 I2C2 READ &H70,0,8,RData() ' read 8 registers I2C2 CLOSE
End Sub
Do
compass
R=rdata(1)*256+rdata(2) Print R
Print
Pause 1000 Loop
End Edited 2022-01-22 00:45 by georgestheking |