uasyncio: Example of the the use of aswitch classes

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

uasyncio: Example of the the use of aswitch classes

Post by Jim.S » Mon Mar 19, 2018 8:38 pm

I am learning about uasyncio, I am working through the examples in micropython-async-master, and am looking at the classes in aswitch.py, These look really useful but I would really like to see an example of their use to help me understand how they work. Can someone point me in the direction of an example, something on git hub for example.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uasyncio: Example of the the use of aswitch classes

Post by pythoncoder » Tue Mar 20, 2018 5:12 am

The README section 1 has a link to Asynchronous Device Drivers which documents the aswitch class. A test program astests.py is provided which demonstrates the driver on Pyboard. Its use is documented in section 4.
Peter Hinch
Index to my micropython libraries.

Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Re: uasyncio: Example of the the use of aswitch classes

Post by Jim.S » Tue Mar 20, 2018 8:11 pm

Thanks Peter. Bit embarrassing really, I had skimmed through that file but was put off running it because I realised I would have to get my soldering iron out, I didn’t study it thoroughly enough to realise it imported aswitch.... off to get my soldering iron.....

Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Re: uasyncio: Example of the the use of aswitch classes

Post by Jim.S » Sat Mar 24, 2018 7:46 pm

... actually I dont think I need to get my soldering iron out to run this code! I have just realised that with these new fangled microcontrollers like the STM32 they actually have the pull up and pull down resistors built in! so you don’t have to solder up a little circuit with a switch and a 10k pull up resistor. If you are careful, I suppose you can just short the pin to ground to test the circuit

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uasyncio: Example of the the use of aswitch classes

Post by pythoncoder » Sun Mar 25, 2018 10:51 am

Indeed. For quick tests I have a Pyboard in the official aluminium case. A lot can be done with a handful of pin-pin jumpers.
Peter Hinch
Index to my micropython libraries.

Post Reply