So I've shamelessly copied AndyGadget's ideas at [Local Link Removed for Guests] and simplified as much as I could.
If you analyze this program, you will see that it only has 18 lines of real code, the rest are comments or demonstration routines.
Code: [Local Link Removed for Guests]
' ESP32: CS=GPIO5 - CLK=GPIO18 - DIN=GPIO23
iobuff.dim(0,64)=8,0,8,0,8,0,8,0,7,0,7,0,7,0,7,0,6,0,6,0,6,0,6,0,5,0,5,0,5,0,5,0,4,0,4,0,4,0,4,0,3,0,3,0,3,0,3,0,2,0,2,0,2,0,2,0,1,0,1,0,1,0,1,0
MAXSCROLL.SETUP 4, 5
SPI.CSPIN 5
SPI.SETUP 1000000 ' SPI bus speed 1MHz
updateMAX
gosub demo1
gosub demo2
END
' -------------------------------
SUB updateMAX
LOCAL row
for row = 0 to 8
spi.write_iobuff(0, row*8, 8)
next row
END SUB
' ------------------------
SUB plot(x, y, on)
LOCAL ofset, bit
ofset = 8*y + 2*(x\8) + 1
bit = (8*(x\8)+7) - x
if on = 1 then iobuff.setbit(0, ofset, bit) else iobuff.clearbit(0, ofset, bit)
updateMAX
END SUB
' ======
' DEMOS:
' ======
demo1:
t = 10
for y = 0 to 7
for x = 0 to 31
plot x, y, 1
pause t
next x
next y
for y = 7 to 0 step -1
for x = 31 to 0 step -1
plot x, y, 0
pause t
next x
next y
return
demo2:
t = 20
for x = 0 to 31 step 2
for y = 7 to 0 step -1
plot x, y, 1
pause t
plot x, y, 0
next y
for y = 0 to 7
p = x+1
plot p, y, 1
pause t
plot p, y, 0
next y
next x
for x = 31 to 0 step -2
for y = 7 to 0 step -1
plot x, y, 1
pause t
plot x, y, 0
next y
for y = 0 to 7
p = x-1
plot p, y, 1
pause t
plot p, y, 0
next y
next x
return
https://youtu.be/5ezaspaLTX8
This basic idea can be expanded as needed, for example, with a subroutine to draw bar graphs:
Code: [Local Link Removed for Guests]
' -------------------------
SUB barGraph(col, value)
LOCAL y
for y = 0 to 7
plot col, y, 0
next y
for y = 0 to value
plot col, y, 1
next y
END SUB
' -------------------------
demo3:
for col = 0 to 31
value = rnd(8)
barGraph col, value
next col
for i = 1 to 5
pause 500
value = rnd(8)
col = rnd(32)
barGraph col, value
next i
return
' ------------------------
demo4:
file$ = "/barometer.txt"
for line = 1 to 32
line$ = file.read$(file$, line)
value = val(line$)
value = convert.map(value, 980, 1040, 0, 7)
col = line - 1
barGraph col, value
next line
return