File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2024 Liz Clark for Adafruit Industries
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ import time
6+ import board
7+ import displayio
8+ import adafruit_displayio_ssd1306
9+ import adafruit_imageload
10+
11+ #display setup
12+ displayio .release_displays ()
13+
14+ i2c = board .STEMMA_I2C ()
15+ # oled
16+ oled_reset = board .D9
17+ display_bus = displayio .I2CDisplay (i2c , device_address = 0x3D , reset = oled_reset )
18+ WIDTH = 128
19+ HEIGHT = 64
20+ display = adafruit_displayio_ssd1306 .SSD1306 (display_bus , width = WIDTH , height = HEIGHT )
21+
22+ # default group
23+ group = displayio .Group ()
24+ display .root_group = group
25+
26+ # graphics bitmap
27+ bitmap , palette_bit = adafruit_imageload .load (
28+ "/bongo.bmp" ,
29+ bitmap = displayio .Bitmap ,
30+ palette = displayio .Palette ,
31+ )
32+ tile_grid = displayio .TileGrid (bitmap , pixel_shader = palette_bit ,
33+ width = 1 , height = 1 ,
34+ tile_height = 64 , tile_width = 105 ,
35+ default_tile = 0 , x = 7 )
36+ group .append (tile_grid )
37+
38+ bongo = 0
39+ index = 0
40+ delay = 0.15
41+
42+ while True :
43+ if (bongo + delay ) < time .monotonic ():
44+ tile_grid [0 ] = index
45+ index = 1 if index == 0 else 0
46+ bongo = time .monotonic ()
You can’t perform that action at this time.
0 commit comments