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 timep13 = 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 possibleLine 25 is ->pycom.heartbeat(False) of the condition p15.
-
You have to turn off the default heatbeat before you can use the RGB led
pycom.heartbeat(False) -
This post is deleted!
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