Skip to content

Instantly share code, notes, and snippets.

@tiede
Created September 19, 2023 10:27
Show Gist options
  • Save tiede/2fa86f08309c0bdc7b9944e58b54d3fb to your computer and use it in GitHub Desktop.
Save tiede/2fa86f08309c0bdc7b9944e58b54d3fb to your computer and use it in GitHub Desktop.
import board
import displayio
import terminalio
import time
from adafruit_display_text import label
from adafruit_display_shapes.rect import Rect
from adafruit_display_shapes.circle import Circle
from adafruit_pybadger import pybadger
import random
SCREEN_WIDTH = 160
SCREEN_HEIGHT = 128
splash = displayio.Group()
board.DISPLAY.show(splash)
rectangle = Rect(0, 0, 20, 20)
rectangle.fill = 0x0000FF
splash.append(rectangle)
circle = Circle(80, 64, 10)
circle.fill = 0xFFFF00
splash.append(circle)
while True:
if pybadger.button.down:
circle.y = circle.y + 1
if pybadger.button.up:
circle.y = circle.y - 1
if pybadger.button.left:
circle.x = circle.x - 1
if pybadger.button.right:
circle.x = circle.x + 1
time.sleep(0.001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment