Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    OSError

    Scheduled Pinned Locked Moved Getting Started
    3 Posts 3 Posters 206 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      Lucas_Vieira
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • K Offline
        kjm
        last edited by

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

         pycom.heartbeat(False) 
        
        1 Reply Last reply Reply Quote 0
        • A Offline
          alexen
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom