Closed high-solutions closed 3 years ago
Imho it's best to start with an asyncio tutorial so you learn how all this async stuff works.
import asyncio
async def async_func():
node = ArtNetNode('IP')
await node.start()
universe = node.add_universe(0)
channel = universe.add_channel(start=1, width=3)
while True:
channel.add_fade([255,0,0], 5000)
await channel.wait_till_fade_complete()
await asyncio.sleep(1)
asyncio.run(async_func())
I'm fairly new to Python so it may be me not understanding how to implement asyncio or async definitions but i can't get past the "read me" "usage" "fades" example, i'm getting an error: await node.start() ^ SyntaxError: 'await' outside function
I'm using version 0.8.2 and in the artnet_node.py the start function is in a 'async def' as an executable statement as it should be so i'm not sure why it's not working.
I tried putting await node.start() in a async def and in a normal def in my script but the error stays the same
Can you explain a little more how to use/start with PyArtNet in the readme?