Search found 70 matches

by on4aa
Sat Jan 27, 2018 8:02 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Re: uasyncio — basic event loop

@cefn All your remarks make perfectly sense. Simply create an 'uncooperative' coroutine function which is scheduled in the round-robin and will block the thread with a utime.sleep() call. Then you have your behaviour, but without lodging it deep in a library where it isn't appropriate. However, the ...
by on4aa
Sat Jan 27, 2018 1:24 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Re: uasyncio — basic event loop

Peter, I completely agree with setting MCUs as the main target. However, it might well be that we are currently unaware of some problems simply because MCUs are typically less dramatic than CPUs (no excessive heating, no fans), or because CPU tools like htop are —as far as I know— unavailable. Since...
by on4aa
Sat Jan 27, 2018 9:55 am
Forum: ESP32 boards
Topic: ESP32 touch sensor pins
Replies: 1
Views: 9076

ESP32 touch sensor pins

On the Heltec ESP32 pinout diagram appear 8 GPIO pins that can be configured as a touch sensor pin. Touch sensor pins are also discussed in the ESP-IDF Programming Guide . How do I deal with these touch sensor pins in MicroPython? Do I need to configure these touch sensor pins in a special way to re...
by on4aa
Sat Jan 27, 2018 9:30 am
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Re: uasyncio — basic event loop

Dear Peter, I beg to disagree on the zero sleep value in Event . The code should run equally well on a CPU-based system with MicroPython Unix as on a MCU-based board. Wasting less electricity and a laptop cooling fan that does not spin up to full speed are two good enough reasons to improve on this....
by on4aa
Fri Jan 26, 2018 10:31 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Re: uasyncio — basic event loop

The culprit for the CPU usage appears to be update_lcd() . EDIT: I tried several things to reduce the CPU usage, but still no luck. This is currently what I have: import uasyncio as asyncio import asyn # https://github.com/peterhinch/micropython-async/blob/master/asyn.py import sys async def sample(...
by on4aa
Fri Jan 26, 2018 10:23 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Re: uasyncio — basic event loop

I am testing this on MicroPython for Unix. With the code now running, I am noticing that one of my CPU cores enters into 100% usage. Honestly, I was not expecting this from uasyncio with all these await statements present. This problem most probably can be solved with placing one or more utime.sleep...
by on4aa
Fri Jan 26, 2018 10:13 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Re: uasyncio — basic event loop

@cefn Thanks, that did it! :D This one of my first experiments with uasyncio and asyn.py , so your help is greatly appreciated. I now changed update_lcd() to: async def update_lcd(data_ready): while True: await data_ready print('LCD updated') data_ready.clear() By the way, asyn.py is available at: h...
by on4aa
Fri Jan 26, 2018 8:47 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library #2
Replies: 3
Views: 3672

Re: uasyncio — Two coroutines awaiting the same event

As a side note, I was wondering whether one can mix and match uasyncio with threading.
More specifically: May a coroutine start a new thread?
by on4aa
Fri Jan 26, 2018 8:42 pm
Forum: Programs, Libraries and Tools
Topic: Some problems with asyn library
Replies: 21
Views: 17563

Some problems with asyn library

I am experiencing trouble with the following basic uasyncio event loop. It runs, taking a sample every 3 seconds, but update_lcd() runs only once instead of once after every sample. What am I doing wrong? import uasyncio as asyncio import asyn # https://github.com/peterhinch/micropython-async/blob/m...
by on4aa
Tue Jan 23, 2018 2:39 pm
Forum: micro:bit boards
Topic: Micro:boy
Replies: 6
Views: 26420

Re: Micro:boy

That is the kind of thing that would get my 13 year old son started on Micro:Bit and MicroPython! :P
Any plans to make it commercially available?