Search found 7 matches

by jpbihin
Sat Oct 24, 2020 6:32 pm
Forum: Programs, Libraries and Tools
Topic: asyncio : cancelling gathered tasks
Replies: 2
Views: 1479

Re: asyncio : cancelling gathered tasks

Thanks Kevin ! in the meantime this is working fine... from machine import Pin import uasyncio as asyncio from pushbutton import Pushbutton p = Pin(26, Pin.IN, Pin.PULL_UP) pb = Pushbutton(p) async def fn_1() : print("fn_1 every 3 s") print(time.time()) await asyncio.sleep(4) async def fn_2() : prin...
by jpbihin
Sat Oct 24, 2020 5:14 pm
Forum: Programs, Libraries and Tools
Topic: asyncio : cancelling gathered tasks
Replies: 2
Views: 1479

asyncio : cancelling gathered tasks

As an exercise, I set myself this goal : cancelling gathered tasks. I'm working with asyncio V3 and a ESP32 from machine import Pin import uasyncio as asyncio from pushbutton import Pushbutton # pushbutton is Kevin Köck's module p = Pin(26, Pin.IN, Pin.PULL_UP) pb = Pushbutton(p) async def fn_1() : ...
by jpbihin
Mon Oct 12, 2020 7:38 pm
Forum: Programs, Libraries and Tools
Topic: uasyncio, loop doesn't stops
Replies: 11
Views: 5336

Re: uasyncio, loop doesn't stops

and thank you Peter for leading me to asyncio V3... and the guide "Application of uasyncio to hardware interfaces".
JP
by jpbihin
Mon Oct 12, 2020 2:50 pm
Forum: Programs, Libraries and Tools
Topic: uasyncio, loop doesn't stops
Replies: 11
Views: 5336

Re: uasyncio, loop doesn't stops

Thank you both for your answers ! I will work on my code soon and come back if necessary.
Regardsn
JP
by jpbihin
Sun Oct 04, 2020 10:58 am
Forum: Programs, Libraries and Tools
Topic: uasyncio, loop doesn't stops
Replies: 11
Views: 5336

uasyncio, loop doesn't stops

Hi, Sorry for this beginner's question... I work with a ESP32-WROOM This is the code reduced to its simplest version : # test asyncio threads import time import machine import sys from machine import I2C, Pin, Timer, Pin, ADC import micropython import uasyncio as asyncio async def fn_1() : while Tru...
by jpbihin
Mon Oct 07, 2019 5:25 pm
Forum: ESP8266 boards
Topic: MQTT publishing crashes with esp8266 and not with esp32
Replies: 3
Views: 2428

Re: MQTT publishing crashes with esp8266 and not with esp32

Hi ! I added def sub_cb(topic_to_esp, message): with some code and client.check_msg() and it works. ;) It means that <client.check_msg()> or <client.wait_msg()> are mandatory as soon as I subscribe to a topic. Right ? I read a lot of your comments on this forum... and I learned a lot... thanks Peter...
by jpbihin
Sun Oct 06, 2019 8:16 am
Forum: ESP8266 boards
Topic: MQTT publishing crashes with esp8266 and not with esp32
Replies: 3
Views: 2428

MQTT publishing crashes with esp8266 and not with esp32

Hi, My ESP8266 (nodemcu board controled with REPL) crashes after 5 loops . See the code below. With an ESP32, the code runs correctly. More information : - when I remove line 45 : <time.sleep(1)> , it works - when I remove the line 25 : < client.subscribe(b"sol") >, its works . Here is the code : im...