OSerror with rgbled



  • setup:
    Pycom Lopy1
    f/w: 1.18.2
    atom+pymakr

    I have a main.py of:

    main.py -- put your code here!

    import time

    time.sleep(2)

    print('main MAC1')

    import pycom
    print('LED test')
    print (0xffffff)
    pycom.rgbled(0x0)

    Using atom I can run this file from the Run command, but it fails when synced with an OSError. It is also ok entering the code at the command line. The error is occurring on the rgbled code. If I # comment the line the following code does not error.

    This is the complete trace from run or press of the lopy reset button:

    ets Jun 8 2016 00:22:57

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun 8 2016 00:22:57

    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1688
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14592
    entry 0x400a059c
    main MAC1
    LED test
    16777215
    Traceback (most recent call last):
    File "main.py", line 12, in <module>
    OSError: the requested operation is not possible
    Pycom MicroPython 1.18.2 [v1.8.6-849-07a52e4] on 2019-02-08; LoPy with ESP32
    Type "help()" for more information.

    Note, this sample is from a larger code sample and I've taken back to the minimum lines that create the error.
    I've reflashed the lopy successfully to latest code.

    Any ideas?



  • import time

    time.sleep(2)
    import pycom

    pycom.heartbeat(False)

    print('main MAC1')

    print('LED test')
    print (0xffffff)
    pycom.rgbled(0x0)

    Try this code. This should run perfectly fine.



  • @johnmcdnz you need to explicitly turn the heartbeat off before you can set a colour on the LED.



Pycom on Twitter