Simple test

Ensure your device works with this simple test.

examples/cursorcontrol_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5import board
 6import displayio
 7from adafruit_cursorcontrol.cursorcontrol import Cursor
 8from adafruit_cursorcontrol.cursorcontrol_cursormanager import CursorManager
 9
10# Create the display
11display = board.DISPLAY
12
13# Create the display context
14splash = displayio.Group()
15
16# initialize the mouse cursor object
17mouse_cursor = Cursor(display, display_group=splash)
18
19# initialize the cursormanager
20cursor = CursorManager(mouse_cursor)
21
22# show displayio group
23display.root_group = splash
24
25while True:
26    cursor.update()
27    if cursor.is_clicked:
28        if mouse_cursor.hidden:
29            mouse_cursor.show()
30        else:
31            mouse_cursor.hide()
32    time.sleep(0.01)