Sub Process_Globals
Private VERSION As String = "rESP3228CYD Example Basic v20250314"
Public Serial1 As Serial
Private lcd As ESP3228CYD
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log(CRLF, CRLF, "[AppStart]", VERSION)
'Init display without touch
lcd.Initialize(Null)
'Call the demo sub
CallSubPlus("Demo", 500, 5)
End Sub
Private Sub Demo(tag As Byte)
lcd.DisplayRotation = 1
' Set screen background color green
lcd.BackgroundColor = lcd.COLOR_GREEN
' Draw version text at top middle center
lcd.DrawText(lcd.Width / 2, 10, VERSION, lcd.TEXT_ALIGN_MIDDLE_CENTER, 1.5, lcd.COLOR_BLUE, lcd.COLOR_GREEN)
' Draw text bottom left using drawtext
lcd.DrawText(10, lcd.Height - lcd.FontHeight(1) - 2, "B4X is great... enjoy", lcd.TEXT_ALIGN_MIDDLE_LEFT, 1, lcd.COLOR_BLACK, lcd.COLOR_DEFAULT)
' Draw some filled shapes
lcd.FillCircle(30, 30, 15, lcd.COLOR_RED)
lcd.FillRoundRect(10, 70, 50, 20, 5, lcd.COLOR_RED)
' Set cursor at x,y position
Dim x,y As ULong
x = 100
y = 100
lcd.SetCursor(x,y)
' Print text in red at cursor position
lcd.SetTextSize(3)
lcd.SetTextColor(lcd.ColorRGB(255,0,0))
lcd.Print("HELLO")
' Print text in white at new cursor position
lcd.SetCursor(100,200)
lcd.SetTextSize(3)
lcd.SetTextColor(lcd.ColorRGB(255,255,255))
lcd.Print("World")
' Draw blue pixel
lcd.DrawPixel(50, lcd.Height / 2 , lcd.COLOR_BLUE)
' Draw lines
lcd.DrawLine(60, 60, 100, 100, lcd.ColorRGB(255,0,0))
'lcd.DrawLine(10, lcd.Height - 20, lcd.Width - 20, lcd.Height - 20, lcd.COLOR_BLUE)
lcd.DrawGradientLine(10, lcd.Height - 20, lcd.Width - 20, lcd.Height - 20, lcd.COLOR_RED, lcd.color_BLACK)
lcd.DrawWideLine(10, lcd.Height / 2, lcd.Width / 2, lcd.Height / 2, 5, lcd.COLOR_CYAN)
'3-point black Bezier curve
lcd.drawBezier3(10, 200, 100, 150, 150, 200, lcd.COLOR_BLACK)
'Draw circles
lcd.DrawCircle(60, 60, 20, lcd.COLOR_BLUE)
'lcd.FillCircle(60, 60, 20, lcd.ColorRGB(255,0,0))
'Dim c As ULong = Bit.ParseInt("000000FF", 32)
'lcd.FillCircle(60, 60, 20, c)
'lcd.FillCircle(150, 150, 20, lcd.COLOR_RED)
' Little triangle
lcd.fillTriangle(80, 80, 60, 80, 80, 60, lcd.COLOR_YELLOW)
'Draw TextBox
lcd.DrawTextBox((lcd.Width / 2) - (100 / 2), 30, 100, 40, "INFO", lcd.COLOR_BLACK, 2, lcd.COLOR_WHITE, lcd.COLOR_RED, 4)
lcd.DrawTextBoxMultiLIne(200, 80, 100, 130, "Line1", "Line2", "Line3", lcd.COLOR_BLACK, 0, lcd.COLOR_LIGHTGRAY, lcd.COLOR_RED, 4)
End Sub