Use of GPIO

    For detailed introduction of GPIO, please refer to GPIO-API Document.

    Instructions

    • Register an IO as a GPIO function
    from Maix import GPIO
    from fpioa_manager import fm
    
    fm.register(io_number,fm.fpioa.GPIO0)
    
    • Set GPIO as input or output mode
    gpio=GPIO(GPIO.GPIO0,GPIO.OUT)
    
    • Read or set GPIO level
    gpio.value(1)
    

    Example

    Turn on the LED

    import utime
    from Maix import GPIO
    from board import board_info
    from fpioa_manager import fm
    
    fm.register(board_info.LED_R,fm.fpioa.GPIO0)
    led_r=GPIO(GPIO.GPIO0,GPIO.OUT)
    utime.sleep_ms(500)
    led_r.value(0)
    fm.unregister(board_info.LED_R)