Exemplo n.º 1
0
def render():
    rgb.clear()
    rgb.background((0, 0, 0))

    for x, y in snake:
        rgb.pixel((255, 255, 255), (x, y))

    rgb.pixel((0, 255, 200), food)
Exemplo n.º 2
0
def vcc_low(sleepTime=0):
    term.header(True, "Going to sleep...")
    rgb.enablecomp()
    rgb.background((0, 0, 0))
    rgb.clear()
    rgb.scrolltext('BATT LOW!')
    time.sleep(4)

    time.sleep(0.1)
    machine.deepsleep(sleepTime)
Exemplo n.º 3
0
def vcc_low(sleepTime=0):
    import term, rgb, machine
    term.header(True, "Going to sleep...")
    rgb.enablecomp()
    rgb.background((0, 0, 0))
    rgb.clear()
    uinterface.skippabletext('BATT LOW!')

    time.sleep(0.1)
    machine.deepsleep(sleepTime)
def next_check():
    if(len(checklist) == 0):
        rgb.clear()
        rgb.background((0, 50, 0))
        rgb.text("Done!", CYAN, (4, 1))
        machine.nvs_setint('system', 'factory_checked', 3)
        return

    background, textcolor, x_pos, text, gpio = checklist.pop(0)
    rgb.clear()
    rgb.background(background)
    rgb.text(text, textcolor, (x_pos, 1))

    buttons.register(gpio, lambda pressed, gpio=gpio: (buttons.unassign(gpio), next_check()) if not pressed else None)
Exemplo n.º 5
0
    def start(self):
        # reset background color
        rgb.background(self.backgroundColor)

        while True:
            time.sleep(.01)
            self.draw_ghost()
            sleep(self.current_speed)

            # set new position
            if self.current_direction == self.LEFT and self.current_x > (
                    self.START_X - self.PAC_WIDTH):
                self.current_x -= 1
                continue
            elif self.current_direction == self.LEFT and self.current_x <= (
                    self.START_X - self.PAC_WIDTH):
                self.current_x = self.MAX_X
                continue
            elif self.current_direction == self.RIGHT and self.current_x >= self.MAX_X:
                self.current_x = self.START_X - (self.PAC_WIDTH)
                continue
            else:
                self.current_x += 1
Exemplo n.º 6
0
import uinterface, urequests, ujson, ntp, rgb, wifi, buttons, defines, system, machine, gc
from default_icons import animation_connecting_wifi, icon_no_wifi

from time import sleep

rgb.background((0, 0, 0))
rgb.clear()
rgb.framerate(20)

WEATHER_API_SERVER = 'https://api.openweathermap.org/data/2.5/weather?id=2745726&mode=json&units=metric&appid=100135c6eb0eeba9bde50e165d4021c1'

action = 0
weather = None
last_update = 0
tick = 0

REFRESH_RATE = 31

rgb.setfont(0)


def disconnect_wifi():
    if wifi.status():
        wifi.disconnect()
        rgb.pixel((255, 0, 0), (31, 0))  # red for no wifi


def connect_wifi():
    rgb.pixel((255, 255, 0), (31, 0))  # yellow connecting to wifi
    if not wifi.status():
        wifi.connect()
Exemplo n.º 7
0
def input_A(pressed):
    if pressed:
        rgb.background((255, 100, 100))
    else:
        rgb.background((0, 0, 0))