first save

This commit is contained in:
tiijay
2025-10-19 18:29:10 +02:00
commit b5a30adb27
1303 changed files with 234711 additions and 0 deletions

29
async.py Normal file
View File

@@ -0,0 +1,29 @@
import uasyncio as asyncio # type: ignore
async def task1():
for i in range(5):
print('Task 1:', i)
await asyncio.sleep(1) # Non-blocking sleep
async def task2():
for i in range(5):
print('Task 2:', i)
await asyncio.sleep(2) # Different sleep time
async def task3():
for i in range(5):
print('Task 3:', i)
await asyncio.sleep(4) # Different sleep time
async def main():
# Run both tasks concurrently
await asyncio.gather(task1(), task2(), task3())
print("we're done.")
# Run the event loop
asyncio.run(main())