Simple test

Ensure your device works with this simple test.

examples/displayio_gauge_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2021 Tim Cocks
 2#
 3# SPDX-License-Identifier: Unlicense
 4
 5"""
 6Create a single gauge and change it's level
 7This works on any CircuitPython device with a built-in display.
 8"""
 9
10import time
11import board
12import displayio
13from displayio_gauge import Gauge
14
15display = board.DISPLAY
16
17# Make the display context
18main_group = displayio.Group()
19
20color_bitmap = displayio.Bitmap(display.width, display.height, 1)
21color_palette = displayio.Palette(1)
22color_palette[0] = 0x000000
23bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
24main_group.append(bg_sprite)
25
26display.show(main_group)
27
28
29example_gauge = Gauge(
30    x=35,
31    y=35,
32    radius=30,
33    foreground_color=0x00FF00,
34    background_color=0x000000,
35    outline_color=0xFFFFFF,
36)
37main_group.append(example_gauge)
38
39while True:
40    for i in range(0, 101):
41        example_gauge.level = i
42        time.sleep(0.05)