#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Dim ALLON() As Byte = Array As Byte(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff) 'row 1 to row 8 and what LED's to switch ON/OFF in each ROW
Dim ALLOFF() As Byte = Array As Byte(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00)
Dim HEART() As Byte = Array As Byte(0x00,0x66,0xff,0xff,0xff,0x7e,0x3c,0x18)
Dim SMILEY() As Byte = Array As Byte(0x3c,0x42,0xa5,0x81,0xa5,0x99,0x42,0x3c)
Dim EXCLAMATION() As Byte = Array As Byte(0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00)
Dim A() As Byte = Array As Byte(0x00,0x3c,0x66,0x66,0x7E,0x66,0x66,0x66)
Dim B() As Byte = Array As Byte(0x78,0x48,0x48,0x70,0x48,0x44,0x44,0x7c)
Dim C() As Byte = Array As Byte(0x00,0x1e,0x20,0x40,0x40,0x40,0x20,0x1e)
Dim D() As Byte = Array As Byte(0x00,0x38,0x24,0x22,0x22,0x24,0x38,0x00)
Dim E() As Byte = Array As Byte(0x00,0x3c,0x20,0x38,0x20,0x20,0x3c,0x00)
Dim F() As Byte = Array As Byte(0x00,0x3c,0x20,0x38,0x20,0x20,0x20,0x00)
Dim G() As Byte = Array As Byte(0x00,0x3c,0x20,0x20,0x2e,0x22,0x3e,0x00)
Dim H() As Byte = Array As Byte(0x00,0x24,0x24,0x3c,0x24,0x24,0x24,0x00)
Dim I() As Byte = Array As Byte(0x00,0x38,0x10,0x10,0x10,0x10,0x38,0x00)
Dim J() As Byte = Array As Byte(0x00,0x1c,0x08,0x08,0x08,0x28,0x38,0x00)
Dim K() As Byte = Array As Byte(0x00,0x24,0x28,0x30,0x28,0x24,0x24,0x00)
Dim L() As Byte = Array As Byte(0x00,0x20,0x20,0x20,0x20,0x20,0x3c,0x00)
Dim M() As Byte = Array As Byte(0x00,0x00,0x44,0xaa,0x92,0x82,0x82,0x00)
Dim N() As Byte = Array As Byte(0x00,0x22,0x32,0x2a,0x26,0x22,0x00,0x00)
Dim O() As Byte = Array As Byte(0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00)
Dim P() As Byte = Array As Byte(0x00,0x38,0x24,0x24,0x38,0x20,0x20,0x00)
Dim Q() As Byte = Array As Byte(0x00,0x3c,0x42,0x42,0x42,0x46,0x3e,0x01)
Dim R() As Byte = Array As Byte(0x00,0x38,0x24,0x24,0x38,0x24,0x24,0x00)
Dim S() As Byte = Array As Byte(0x00,0x3c,0x20,0x3c,0x04,0x04,0x3c,0x00)
Dim T() As Byte = Array As Byte(0x00,0x7c,0x10,0x10,0x10,0x10,0x10,0x00)
Dim U() As Byte = Array As Byte(0x00,0x42,0x42,0x42,0x42,0x24,0x18,0x00)
Dim V() As Byte = Array As Byte(0x00,0x22,0x22,0x22,0x14,0x14,0x08,0x00)
Dim W() As Byte = Array As Byte(0x00,0x82,0x92,0x54,0x54,0x28,0x00,0x00)
Dim X() As Byte = Array As Byte(0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00)
Dim Y() As Byte = Array As Byte(0x00,0x44,0x28,0x10,0x10,0x10,0x10,0x00)
Dim Z() As Byte = Array As Byte(0x00,0x3c,0x04,0x08,0x10,0x20,0x3c,0x00)
Dim ZERO() As Byte = Array As Byte(0x70,0x88,0x98,0xa8,0xc8,0x88,0x70,0x00)
Dim ONE() As Byte = Array As Byte(0x30,0x70,0x30,0x30,0x30,0x30,0xfc,0x00)
Dim TWO() As Byte = Array As Byte(0x78,0xcc,0x0c,0x38,0x60,0xcc,0xfc,0x00)
Dim THREE() As Byte = Array As Byte(0x78,0xcc,0x0c,0x38,0x0c,0xcc,0x78,0x00)
Dim FOUR() As Byte = Array As Byte(0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x1e,0x00)
Dim FIVE() As Byte = Array As Byte(0xfc,0xc0,0xf8,0x0c,0x0c,0xcc,0x78,0x00)
Dim SIX() As Byte = Array As Byte(0x38,0x60,0xc0,0xf8,0xcc,0xcc,0x78,0x00)
Dim SEVEN() As Byte = Array As Byte(0xfc,0xcc,0x0c,0x18,0x30,0x30,0x30,0x00)
Dim EIGHT() As Byte = Array As Byte(0x78,0xcc,0xcc,0x78,0xcc,0xcc,0x78,0x00)
Dim NINE() As Byte = Array As Byte(0x78,0xcc,0xcc,0x7c,0x0c,0x18,0x70,0x00)
Dim timeCount As Float = 0
Dim row(8) As Pin
Dim col(8) As Pin
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
For i1 = 0 To 7
row(i1).Initialize(i1+2, row(i1).MODE_OUTPUT)
Next
For j1 = 0 To 7
col(j1).Initialize(j1+10, col(i1).MODE_OUTPUT)
Next
AddLooper("Looper1")
End Sub
Sub Looper1
Delay(5)
timeCount = timeCount + 1
If (timeCount < 40) Then
drawscreen(B)
else if (timeCount < 80) Then
drawscreen(E)
else if (timeCount < 120) Then
drawscreen(L)
else if (timeCount < 160) Then
drawscreen(I)
else if (timeCount < 200) Then
drawscreen(N)
else if (timeCount < 240) Then
drawscreen(D)
else if (timeCount < 280) Then
drawscreen(A)
else if (timeCount < 320) Then
drawscreen(ALLON)
else if (timeCount < 360) Then
drawscreen(ALLOFF)
else if (timeCount < 400) Then
drawscreen(SMILEY)
else if (timeCount < 440) Then
drawscreen(HEART)
else if (timeCount < 480) Then
drawscreen(EXCLAMATION)
else if (timeCount < 520) Then
drawscreen(ZERO)
else if (timeCount < 560) Then
drawscreen(ONE)
else if (timeCount < 600) Then
drawscreen(TWO)
else if (timeCount < 640) Then
drawscreen(THREE)
else if (timeCount < 680) Then
drawscreen(FOUR)
else if (timeCount < 720) Then
drawscreen(FIVE)
else if (timeCount < 760) Then
drawscreen(SIX)
else if (timeCount < 800) Then
drawscreen(SEVEN)
else if (timeCount < 840) Then
drawscreen(EIGHT)
else if (timeCount < 880) Then
drawscreen(NINE)
Else
timeCount = 0
End If
End Sub
Sub drawscreen(letter() As Byte)
For i1 = 0 To 7
row(i1).DigitalWrite(True)
For j1 = 0 To 7
Dim tempbyte As Byte = Bit.ShiftRight(letter(i1),j1)
tempbyte = Bit.And(tempbyte,0x01)
If tempbyte <> 0 Then
col(j1).DigitalWrite(False) 'change this to true for reversed out letter
Else
col(j1).DigitalWrite(True) 'change this to false for reversed out letter
End If
DelayMicroseconds(100)
col(j1).DigitalWrite(True)
Next
row(i1).DigitalWrite(False)
Next
End Sub