| Posted: 02:59pm 21 Jan 2022 |
|
|
|
Glad you got it working. Note that the customary way to show code in a post is to include it within the forum tags "[ CODE]" and "[ /CODE]" (without the quote marks and without the space following "[".
Like this: 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
Note that this preserves indentation if your code has any. |