-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathduino-1088as.bas
More file actions
61 lines (53 loc) · 1.13 KB
/
duino-1088as.bas
File metadata and controls
61 lines (53 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import ioio
' mosi = master-in slave-out (miso is unused here)
const mosiPin = 2
const misoPin = 6
const csPin = 3
const clkPin = 4
spi = ioio.openSpiMaster(misoPin, mosiPin, clkPin, csPin)
ioio.waitForConnect(10)
spi.write(0x09, 0x00) ' Decode mode: no decode for digits 0-7
spi.write(0x0A, 0x00) ' Intensity: maximum intensity 0x0 -> 0x0F
spi.write(0x0B, 0x07) ' Scan limit: all digits
spi.write(0x0C, 0x01) ' Shutdown: normal operation
for i = 1 to 8
spi.write(i, 0)
next
const glyph_a = [
[0,0,0,0,1,0,0,0],
[0,0,0,1,0,1,0,0],
[0,0,1,0,0,0,1,0],
[0,0,1,0,0,0,1,0],
[0,0,1,1,1,1,1,0],
[0,1,0,0,0,0,0,1],
[0,1,0,0,0,0,0,1],
[0,0,0,0,0,0,0,0],
]
const glyph_b = [
[0,1,0,0,0,0,0,0],
[0,1,0,0,0,0,0,0],
[0,1,0,0,0,0,0,0],
[0,1,1,1,0,0,0,0],
[0,1,0,0,1,0,0,0],
[0,1,0,0,0,1,0,0],
[0,1,0,0,0,1,0,0],
[0,0,1,1,1,0,0,0],
]
sub print_glyph(byref f)
local i, k, n
for i = 0 to 7
n = 0
for k = 0 to 7
if (f[i][k] == 1) then
n += pow(2, 7 - k)
endif
next k
spi.write(i + 1, n)
next i
end
while 1
print_glyph(glyph_a)
delay 1000
print_glyph(glyph_b)
delay 1000
wend