Beispiel #1
0
# main.py -- put your code here!
import pyb
import dcfurs
import badge
import emote
import micropython
import settings
import ubinascii

print("Booting...")
import animations

## Select the user's preferred boot animation.
available = animations.all()
selected = 0
if settings.bootanim:
    try:
        selected = available.index(getattr(animations, settings.bootanim))
    except Exception:
        pass


## Handle events from the bluetooth module.
def check_ble():
    if not badge.ble:
        return

    flags = badge.ble.read(badge.ble.REG_FLAGS)
    if flags & badge.ble.FLAG_EMOTE:
        emote.random()
        pyb.delay(2500)
Beispiel #2
0
# main.py -- put your code here!
import pyb
import dcfurs
import badge
import emote
import micropython
import settings
import ubinascii

print("Booting...")
import animations

## Select the user's preferred boot animation.
available = sorted(animations.all(), key=lambda animation: animation.__name__)
selected = 0
if settings.bootanim:
    try:
        selected = available.index(getattr(animations, settings.bootanim))
    except Exception:
        pass


## Handle events from the bluetooth module.
def check_ble():
    if not badge.ble:
        return

    flags = badge.ble.read(badge.ble.REG_FLAGS)
    if flags & badge.ble.FLAG_EMOTE:
        ## Remote emote extravaganza!
        value = badge.ble.read16(badge.ble.REG_EMOTE)