tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/ili9341/scroll/main.go (about) 1 package main 2 3 import ( 4 "image/color" 5 "time" 6 7 "tinygo.org/x/drivers/examples/ili9341/initdisplay" 8 "tinygo.org/x/drivers/ili9341" 9 ) 10 11 var ( 12 red = color.RGBA{255, 0, 0, 255} 13 blue = color.RGBA{0, 0, 255, 255} 14 green = color.RGBA{0, 255, 0, 255} 15 black = color.RGBA{0, 0, 0, 255} 16 white = color.RGBA{255, 255, 255, 255} 17 ) 18 19 var ( 20 display *ili9341.Device 21 ) 22 23 func main() { 24 display := initdisplay.InitDisplay() 25 26 width, height := display.Size() 27 28 display.FillRectangle(0, 0, width/2, height/2, white) 29 display.FillRectangle(width/2, 0, width/2, height/2, red) 30 display.FillRectangle(0, height/2, width/2, height/2, green) 31 display.FillRectangle(width/2, height/2, width/2, height/2, blue) 32 display.FillRectangle(width/4, height/4, width/2, height/2, black) 33 34 for scroll := int16(0); ; scroll = (scroll + 1) % 320 { 35 time.Sleep(7500 * time.Microsecond) 36 display.SetScroll(scroll) 37 } 38 39 }