Ejemplo n.º 1
0
def main(addon):
    umountfloppy()
    print("Floppy disk driver v1.0")
    eeprom = create_eeprom(addon)
    fs = mount_eeprom(eeprom, "/floppy")
    print("Floppy label:", fs.label)
    print("Files:", os.listdir('/floppy'))
    print("Free space", free_bytes(fs))
    if isdir('/viral'):
        print("Copying files to floppy")
        prepare_floppy('/viral', fs)
        storage.umount('/floppy')
        print("Floppy ready!")
    else:
        if isfile('/floppy/main.py'):
            supervisor.disable_autoreload()
            try:
                __import__('/floppy/main')
            except Exception as err:
                print("Floppy error: {}".format(err))
            finally:
                supervisor.enable_autoreload()
Ejemplo n.º 2
0
        defaultDelay = int(line[13:]) * 10
    elif (line[0:3] == "LED"):
        if (led.value == True):
            led.value = False
        else:
            led.value = True
    else:
        newScriptLine = convertLine(line)
        runScriptLine(newScriptLine)


kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayout(kbd)

# turn off automatically reloading when files are written to the pico
supervisor.disable_autoreload()

# sleep at the start to allow the device to be recognized by the host computer
time.sleep(.5)

led_pwm_up(led)


def getProgrammingStatus():
    # check GP0 for setup mode
    # see setup mode for instructions
    progStatusPin = digitalio.DigitalInOut(GP0)
    progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
    progStatus = not progStatusPin.value
    return (progStatus)