I have been trying to use two cores for the automation 2040 w mini. No matter what I do I keep getting a core1 in use error . The code is simple and I still can’t get it to run
import machine
import utime # access internal clock of raspberry Pi Pico
import _thread # to access threading function
spLock = _thread.allocate_lock() # creating semaphore
def core1_task():
while True:
spLock.acquire() # acquiring semaphore lock
print( "message from core_1")
utime.sleep(0.5) # 0.5 sec or 500us delay
spLock.release()
_thread.start_new_thread(core1_task, ())
while True:
spLock.acquire()
print( "message from Core_0 ")
utime.sleep( 0.5)
spLock.release()