OK, try this one (it's messy):
Code:
import time, _thread, machine, gcfrom machine import Pingc.collect()led = machine.Pin(25,mode=Pin.OUT,value=0)led.on(); time.sleep_ms(50); led.off()myLock=_thread.allocate_lock()def task(): global myLock print("Core1 thread started") time.sleep_us(1000) myLock.acquire() for i in range(30): print (" C1:%i %i %i"%(i,time.ticks_us(),myLock.locked())) myLock.release()_thread.start_new_thread(task,())print("Core0 thread started")for i in range(100): myLock.acquire() print (" C0:%i %i %i"%(i,time.ticks_us(),myLock.locked())) myLock.release() led.on(); time.sleep_ms(50); led.off(); time.sleep_ms(50); led.on(); time.sleep_ms(50); led.off()
Statistics: Posted by gmx — Sat Dec 07, 2024 11:39 pm