Пример #1
0
def display_dot():
    c = controller_box.ControllerBox()
    color = color565(255, 0, 0)
    black = color565(0, 0, 0)

    display = c.display
    joy_x = c.joystick.x
    joy_y = c.joystick.y

    w = 40
    h = 64
    # buf = display.load_sprite('gdg_small.raw', 40, 64)

    prev = (0, 0)
    while True:
        if c.interrupt():
            display.clear(black)
            break
        x = 127 - (max(6, min(120, int(joy_x.read() / 32))))
        y = max(6, min(120, int(joy_y.read() / 32)))
        display.clear(black)
        display.fill_circle(x, y, 6, color)
Пример #2
0
import pin_definitions as pd
from machine import Pin
import time

import controller_box

c = controller_box.ControllerBox()

time.sleep_ms(300)

if c.joystick_sw.value() ==  0:
    # Test all components
    import component_test
    component_test.all_test(c)
else:
    # Arkanoid game
    import arkanoid
    arkanoid.main(c)