def prepareForSleep():
    configureWakeupSource()
    try:
        os.umountsd()
    except:
        pass
    mpr121.set(10, False)
    eink.busy_wait()
Ejemplo n.º 2
0
easydraw.messageCentered("Installing...", False)
display.flush()
import dashboard.resources.png_icons as icons
icons.install()

# 6) Set flag
machine.nvs_setint('system', 'factory_checked', CURR_TGT)
machine.nvs_setint('system', 'force_sponsors', 1)

# 7) Show message
easydraw.messageCentered("PASSED", True)
display.flush()

# 8) Blink LEDs and make noise

mpr121.set(10, 1)  # Calibration resets MPR121, here we re-enable LED power

buzzer_pin = machine.Pin(12, machine.Pin.OUT)
time.sleep(0.01)
buzzer_pwm = machine.PWM(buzzer_pin, duty=50)

sndmixer.begin(2)
synth = sndmixer.synth()
sndmixer.volume(synth, 50)
sndmixer.waveform(synth, 1)

while True:
    buzzer_pwm.duty(50)
    buzzer_pwm.freq(500)
    sndmixer.freq(synth, 500)
    neopixel.send(bytes([0xFF, 0, 0] * 12))
Ejemplo n.º 3
0
def setPower(state):
    mpr121.set(10, state)
Ejemplo n.º 4
0
def vibrator_activate(duration):
    mpr121.set(8, 1)
    time.sleep_ms(duration * 10)
    mpr121.set(8, 0)
    while True:
        time.sleep(1)  #Sleep forever

# 4) Install icons (workaround)
easydraw.messageCentered("Installing...", False)
display.flush()
import dashboard.resources.png_icons

# 5) Set flag
machine.nvs_setint('system', 'factory_checked', 2)

# 6) Show message
easydraw.messageCentered("PASSED", True)
display.flush()

mpr121.set(10, 1)  #Calibration resets MPR121

buzzer_pin = machine.Pin(12, machine.Pin.OUT)
time.sleep(0.01)
buzzer_pwm = machine.PWM(buzzer_pin, duty=50)

while True:
    buzzer_pwm.duty(50)
    buzzer_pwm.freq(500)
    neopixel.send(bytes([0xFF, 0, 0] * 12))
    time.sleep(0.25)
    buzzer_pwm.freq(600)
    neopixel.send(bytes([0, 0xFF, 0] * 12))
    time.sleep(0.25)
    buzzer_pwm.freq(800)
    neopixel.send(bytes([0, 0, 0xFF] * 12))
def prepareForWakeup():
    mpr121.set(10, True)
    time.sleep(0.05)  # Give the SD card time to initialize itself
    os.mountsd()
Ejemplo n.º 7
0
def leds(state):
	_mpr121.set(10, state)