Beispiel #1
0
# We want to use clock both as an option
# and as the idle plugin
clock = Clock(backlight)
"""
Using a set of nested dictionaries you can describe
the menu you want to display on dot3k.

A nested dictionary describes a submenu.
An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc
A function name will call that function.
"""
menu = Menu(
    {
        'Clock': clock,
        'Radio Stream': Radio(),
        'Volume': Volume(backlight),
        'Status': {
            'CPU': GraphCPU(),
            'Temp': GraphTemp()
        },
        'Settings': {
            'Contrast': Contrast(lcd),
            'Backlight': Backlight(backlight)
        }
    },
    lcd,  # Draw to dot3k.lcd
    clock,  # Idle with the clock plugin,
    10  # Idle after 10 seconds
)
"""
You can use anything to control dot3k.menu,
Beispiel #2
0
See GraphTemp, GraphCPU, Contrast and Backlight for examples.
"""
my_invader = SpaceInvader()

menu = Menu(
    {
        'Space Invader': my_invader,
        'Clock': Clock(),
        'Status': {
            'IP': IPAddress(),
            'CPU': GraphCPU(),
            'Temp': GraphTemp()
        },
        'Settings': {
            'Volume': Volume(),
            'Display': {
                'Contrast': Contrast(lcd),
                'Backlight': Backlight(backlight)
            }
        }
    }, lcd, my_invader, 30)
"""
You can use anything to control dot3k.menu,
but you'll probably want to use dot3k.joystick
"""
REPEAT_DELAY = 0.5


@joystick.on(joystick.UP)
def handle_up(pin):