OSError



  • Hi, guys. I have a problem in my code. I'm using Atom. Can you help me?

    from machine import Pin
    import pycom
    import time

    p13 = Pin('P13',mode=Pin.IN)
    p14 = Pin('P14',mode=Pin.IN)
    p15 = Pin('P15',mode=Pin.IN);
    p16 = Pin('P16',mode=Pin.IN)
    p18 = Pin('P18',mode=Pin.IN)

    while True:

    if p13.value() == False:
        for cycles in range(1):
            pycom.rgbled(0x0000FF)
            #print('Nivel esta em 1 metro a cima do rio!')
            time.sleep(.8)
            pycom.heartbeat(False)
            time.sleep(.8)    
    if p15.value() == False:
        for cycles in range(1):
            pycom.rgbled(0xcFFFF00)
            #print('Nivel esta em 3 metros a cima do rio!')
            time.sleep(.8)
            pycom.heartbeat(False)
            time.sleep(.8)
    if p16.value() == True:
        for cycles in range(1):
            pycom.rgbled(0xff0000)
            #print('Nivel esta em 4 metro a cima do rio!')
            time.sleep(.8)
            pycom.heartbeat(False)
            time.sleep(.8)
    
    if p18.value() == False: 
        for cycles5 in range(1):
            pycom.rgbled(0xFF00FF)
            #print('Esta chovendo no rio!')
            time.sleep(.8)
            pycom.heartbeat(False)
            time.sleep(.8)
    

    I'm being notified with the error:

    Traceback (most recent call last):
    File "main.py", line 25, in <module>
    OSError: the requested operation is not possible

    Line 25 is ->pycom.heartbeat(False) of the condition p15.



  • This post is deleted!


  • You have to turn off the default heatbeat before you can use the RGB led

     pycom.heartbeat(False) 
    

Log in to reply
 

Pycom on Twitter