I am actually on a project that needs concurentials functions... but I don't really know (and understand) a lot about it. My program must run on a Raspberry pi pico with Circuitpython. I did some research and the most suitable library for this is Asyncio.
Here is in a nutshell my program:
async def playAudio(import 1, import 2):
*some actions....*
print("audio") #added this to debug
if audio not played yet:
playAudio()
async def lcdScreen(import 1, import 2):
print("LCD") #added this to debug
*some actions....*
lcd.print("*something*")
time.sleep(1)
lcd.print("*something else*")
time.sleep(1)
async def story(imports of both functions)
L = await asyncio.gather(
playAudio(imports),
playAudio(imports),
)
print(l)
while True:
*some actions....*
asyncio.run(story(*all imports)
When I run the program, I get:
Audio
*then a while later:*
LCD
This might be a beginner problem, but I can't figure out how to make this work. I checked online and saw that I need ```await``, but again can't figure out how to apply it to this case :(
I imported Asyncio with Circup from a Windows 11
Thanks for your help !
NOTE: I tried to follow examples from Asyncio Library
awaiton something), then other async coroutines will never have the chance to run. BecauseplayAudionever callsawait, nothing else can run until the function completes.playAudiois implemented, and in the sample you've posted nothing actually callslcdScreen.