This is simply a B4R sketch intended for scrolling text on LCD screens
Scrolling from row 19 to row 0:
ub Process_Globals
Public Serial1 As Serial
Private LCD As LiquidCrystal_I2C 'good for the two LCD screens connected
Public bc As ByteConverter
Public SPEED = 300 As Int '(in milliseconds - Decrease this number to speed up scrolling or increase it to slow down)
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
LCD.Initialize(0x27, 20, 4) 'Initializing the LCD screen with 4 lines of 20 characters
'First LCD screen: SDA pin connected to A4 pin or SDA pin - SCL pin connected to A5 pin or SCL pin
'Second LCD Screen: SDA pin connected to SDA pin of the Arduino board, SCL pin connected to SCL pin of the Arduino board
LCD.Backlight = True 'Activates the backlight on the two LCD screens
Scrolling
End Sub
Sub Scrolling
Dim b() As Byte = "HELLO, WELCOME TO LCD SCREENS "
Dim L = b.Length As Int
Dim NC = 1 As Int
LCD.CLEAR
For i = 19 To 0 Step -1
LCD.SetCursor(i,0)
LCD.Write(bc.SubString2(b, 0, NC))
Delay(SPEED)
NC = NC + 1
Next
Scrolling the rest of the text:
For i = 1 To L
If i + 20 > L Then Exit
LCD.SetCursor(0,0)
LCD.Write(bc.SubString2(b, i, i + 20))
Delay(SPEED)
Next
Attachments
Last edited: