Search found 34 matches

by cemox
Sun May 03, 2020 4:29 am
Forum: General Discussion and Questions
Topic: uasyncio : Cancelling a task
Replies: 5
Views: 3926

Re: uasyncio : Cancelling a task

Thanks Peter, I did exactly what you said and it works :). Something like this:

Code: Select all

playTask = asyncio.create_task(play(url1, port1))
and in change_station coro:

Code: Select all

async def changeChannel():
	playTask.cancel()
        playTask = asyncio.create_task(play(url2, port2))
by cemox
Sat May 02, 2020 9:52 am
Forum: General Discussion and Questions
Topic: uasyncio : Cancelling a task
Replies: 5
Views: 3926

Re: uasyncio : Cancelling a task

Thanks Peter. Actually, what I am trying to do is to change the url of of a connection (web radio). async def play(url, port): global buff global bufferfull _, _, host, path = url.split('/', 3) print(host, path) addr = socket.getaddrinfo(host, port)[0][-1] reader, writer = await asyncio.open_connect...
by cemox
Sat May 02, 2020 7:15 am
Forum: General Discussion and Questions
Topic: uasyncio : Cancelling a task
Replies: 5
Views: 3926

uasyncio : Cancelling a task

I am trying to cancel a task and start a new one (with new parameters). (Board ESP8266, latest Mciropython from Master Branch in github) import uasyncio as asyncio async def delayN(n): while (True): print("delay for {} seconds".format(n)) await asyncio.sleep(n) async def delay1(): while (True): prin...
by cemox
Sat May 02, 2020 5:06 am
Forum: Programs, Libraries and Tools
Topic: VS1053 asynchronous socket read
Replies: 5
Views: 4591

Re: VS1053 asynchronous socket read

Thank you. I am using

Code: Select all

reader, writer = await asyncio.open_connection(host, port)
in my function now.
by cemox
Fri May 01, 2020 3:37 pm
Forum: ESP8266 boards
Topic: What makes WiFi config persistent?
Replies: 6
Views: 6566

Re: What makes WiFi config persistent?

Thank you, it works.
by cemox
Thu Apr 30, 2020 8:25 am
Forum: ESP8266 boards
Topic: What makes WiFi config persistent?
Replies: 6
Views: 6566

Re: What makes WiFi config persistent?

Yesterday, I compiled the latest version of micropython for ESP8266 and I started seeing this annoying output in repl repeatedly: connected with Cisti, channel 1 dhcp client start... ip:192.168.1.4,mask:255.255.255.0,gw:192.168.1.1 state: 5 -> 2 (22c0) rm 0 reconnect state: 2 -> 0 (0) scandone state...
by cemox
Tue Apr 28, 2020 11:28 am
Forum: Programs, Libraries and Tools
Topic: VS1053 asynchronous socket read
Replies: 5
Views: 4591

VS1053 asynchronous socket read

I am building a simple internet radio with my ESP8266 Lolin Board + VS1053 board. The code below works (I removed irrelevant parts of the code): from machine import Pin, SPI import utime import socket hspi = SPI(1, baudrate=2000000) #2M is good url = 'http://mp3channels.webradio.antenne.de/chillout'...
by cemox
Tue Apr 28, 2020 11:15 am
Forum: Programs, Libraries and Tools
Topic: How to check socket binding is done or not?
Replies: 2
Views: 1895

Re: How to check socket binding is done or not?

Sorry, I forgot to tell. It is ESP8266 (Lolin) board. Thanks for your reply. I solved it by calling the connect() function a couple of times repeatedly, it works somehow.
by cemox
Sun Mar 15, 2020 9:57 am
Forum: Programs, Libraries and Tools
Topic: How to check socket binding is done or not?
Replies: 2
Views: 1895

How to check socket binding is done or not?

Hi, I have a function that creates a socket for UDP connection and it works fine. def connect(): conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # server_address = (ip, port) print ('starting up on %s port %s' % server_address) conn.bind(server_address) conn.settimeout(0) # conn.settimeout(N...
by cemox
Wed Jun 05, 2019 10:50 am
Forum: Programs, Libraries and Tools
Topic: retrieving data from coro (esp822)
Replies: 3
Views: 2370

Re: retrieving data from coro (esp822)

I actually went through your tutorial and your GPS solution, but I think I should check them once more in detail. Thank you.