I have successfully used aswitch to (a) send an event to a coro to get it to continue running (b) set a parameter to terminate a while loop, i.e.
Code: Select all
loop=asyncio.get_event_loop()
self.consumer_on_event=asyn.Event()
pin11 = Pin('X11', Pin.IN, Pin.PULL_UP)
switch11=sw.Switch(pin11)##3
switch11.close_func(self.consumer_on_event.set)
Code: Select all
pin12= Pin('X12', Pin.IN, Pin.PULL_UP)
switch12=sw.Switch(pin12)##4
switch12.close_func(self.set_parameter,(False,)) #set_ parameter is just a simple class method to set a boolan flag
Code: Select all
await asyn.Cancellable.cancel_all(group='consumer')
Code: Select all
switch12.close_func(asyn.Cancellable.cancel_all,(group='consumer',) )
Code: Select all
switch12.close_func(asyn.Cancellable.cancel_all(group='consumer'))
What am I doing wrong?