Skip to content
Rodion Gorkovenko edited this page Feb 17, 2018 · 2 revisions

Reading registers with builtin arduino i2c

3 poke 0xbc;0
5 delay 100
7 poke 0xb8;7
10 rem Send Addr + R
11 poke 0xbc;0b10100100
15 delay 10
20 poke 0xbb;33
30 poke 0xbc;0b10000100
35 delay 100
40 print "Status: ";peek(0xb9)
45 i = 0
50 poke 0xbc;0b11000100
55 delay 100
60 x=peek(0xbb)
61 gosub 200
62 if i%2;print ""
65 i = i+1
70 if i<30;goto 50
75 poke 0xbc;0b10000100
76 delay 100
80 poke 0xbc;0b10010100
99 end

200 rem Print 2-digit hex from X
201 x1=2
210 xx = x/16 + '0
220 if xx>'9;xx=xx-'0+'A-10
225 emit xx
230 x=(x%16)*16
240 x1=x1-1
250 if x1; goto 210
260 return
Clone this wiki locally