I recently picked up a TI-Innovator Hub and finally decided to do something with it, since I haven't seen many people use it much at all.
I wrote a driver for 8x8 LED matrix displays using the MAX7219 chip. You can find matrix displays with this chip already soldered to a board on Amazon for $9 here. The driver is written purely in TI-BASIC and can be controlled through TI-BASIC. Here is code utilizing the driver that displays a smiley face on 8x8 display:
Code:
The driver works by having you pass strings into it. I called it "EBED" for "eight-by-eight display".
The first character of the string represents a specific command, and then any following characters are the input for the command. The "S" command means "start/boot up the display". The "I" command lets you set the display's intensity (aka brightness), and can take values 0-7. The "D" command draws a 64 bit buffer of 0s and 1s to the display. The "E" command shuts down the display.
There's also the "W" command that writes 16 bits into MAX7219 chip's internal register, and the "B" command that converts an integer to a 16-bit binary value. These are mainly used by the driver itself and you don't really need to worry about them.
Here's a video of the above code running:
As you can see, it's pretty slow, I can't really do much about TI-BASIC's slowness. The TI-Innovator Hub requires the use of TI-BASIC.
Here's the actual code for the driver:
Code:
The driver expects CLK to be BB1, CS to be BB2, and DIN to be BB3.
The driver is based off the data sheet here.
I wrote a driver for 8x8 LED matrix displays using the MAX7219 chip. You can find matrix displays with this chip already soldered to a board on Amazon for $9 here. The driver is written purely in TI-BASIC and can be controlled through TI-BASIC. Here is code utilizing the driver that displays a smiley face on 8x8 display:
Code:
ClrHome
Disp "Starting display..."
"S":prgmEBED
Disp "Dimming display..."
"I0":prgmEBED
Disp "Drawing to display.."
"D"
Ans+"00000000"
Ans+"00100100"
Ans+"00100100"
Ans+"00100100"
Ans+"10000001"
Ans+"01000010"
Ans+"00111100"
Ans+"00000000"
prgmEBED
Disp "Shutting down display..."
"E":prgmEBED
The driver works by having you pass strings into it. I called it "EBED" for "eight-by-eight display".
The first character of the string represents a specific command, and then any following characters are the input for the command. The "S" command means "start/boot up the display". The "I" command lets you set the display's intensity (aka brightness), and can take values 0-7. The "D" command draws a 64 bit buffer of 0s and 1s to the display. The "E" command shuts down the display.
There's also the "W" command that writes 16 bits into MAX7219 chip's internal register, and the "B" command that converts an integer to a 16-bit binary value. These are mainly used by the driver itself and you don't really need to worry about them.
Here's a video of the above code running:
As you can see, it's pretty slow, I can't really do much about TI-BASIC's slowness. The TI-Innovator Hub requires the use of TI-BASIC.
Here's the actual code for the driver:
Code:
Ans->Str0
sub(Str0,1,1)->Str1
If Str1="W"
Then
For(I,2,length(Str0))
If sub(Str0,I,1)="0"
Then
Send("SET BB3 OFF")
Else
Send("SET BB3 ON")
End
Send("SET BB1 ON")
Send("SET BB1 OFF")
End
Send("SET BB2 ON")
Send("SET BB2 OFF")
Return
End
If Str1="S"
Then
Send("SET BB1 OFF")
Send("SET BB2 OFF")
Send("SET BB3 OFF")
"W0000101100000111"
prgmEBED
"W0000100100000000"
prgmEBED
"W0000110000000001"
prgmEBED
"W0000111100000000"
prgmEBED
Return
End
If Str1="B"
Then
"B"->Str1
expr(sub(Str0,2,length(Str0)-1))->S
For(I,1,8)
remainder(S,2)->V
If V=0
Then
"0"+Str1->Str1
Else
"1"+Str1->Str1
End
(S-V)/2->S
End
sub(Str1,1,8)->Str1
Return
End
If Str1="I"
Then
"B"+sub(Str0,2,length(Str0)-1)
prgmEBED
"W00001010"+Ans
prgmEBED
Return
End
If Str1="D"
Then
sub(Str0,2,64)->Str3
For(K,1,8)
"E"->Str2
For(L,0,7)
sub(Str3,K+L*8,1)+Str2->Str2
End
sub(Str2,1,8)->Str2
"B"+toString(K)
prgmEBED
"W"+Ans+Str2
prgmEBED
End
Return
End
If Str1="E"
Then
"W0000110000000000"
prgmEBED
Return
End
The driver expects CLK to be BB1, CS to be BB2, and DIN to be BB3.
The driver is based off the data sheet here.