Search found 22 matches

by zedtech
Tue Jan 02, 2018 3:07 am
Forum: General Discussion and Questions
Topic: How to use non blocking functions, asynchronous tasks
Replies: 21
Views: 10481

Re: How to use non blocking functions, asynchronous tasks

import uasyncio as uasyncio import machine import usocket as socket import network import ntptime #connect to local wifi stat = network.WLAN(network.STA_IF) stat.active(True) stat.connect('ssid','passwd') #set socket webserver s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setblocking(False...
by zedtech
Sun Dec 31, 2017 7:39 pm
Forum: General Discussion and Questions
Topic: How to use non blocking functions, asynchronous tasks
Replies: 21
Views: 10481

Re: How to use non blocking functions, asynchronous tasks

Yes, that's possible and when i do socket.setblocking(False) I'm getting the error "oserror:[errno 11] eagain
by zedtech
Sat Dec 30, 2017 4:10 pm
Forum: General Discussion and Questions
Topic: How to use non blocking functions, asynchronous tasks
Replies: 21
Views: 10481

Re: How to use non blocking functions, asynchronous tasks

@dexterlabora,
Hey I have a similar issue and I'm wondering if you have been able to find the fix and so if please share the solution.
Thanks in advance.
by zedtech
Sat Dec 30, 2017 3:45 pm
Forum: General Discussion and Questions
Topic: How to use non blocking functions, asynchronous tasks
Replies: 21
Views: 10481

Re: How to use non blocking functions, asynchronous tasks

I have become familiar with cooperative multitasking using uasyncio library after digging into the example you posted for reference. However, I can't still achieve the desired goal. I'm using socket.socket object awaiting for a connection to happen and from what i read, its functions are blocking fu...
by zedtech
Sat Dec 30, 2017 1:27 pm
Forum: General Discussion and Questions
Topic: How to use non blocking functions, asynchronous tasks
Replies: 21
Views: 10481

Re: How to use non blocking functions, asynchronous tasks

Thanks for your suggestion. I'm digging into it.
by zedtech
Sat Dec 30, 2017 6:30 am
Forum: General Discussion and Questions
Topic: How to use non blocking functions, asynchronous tasks
Replies: 21
Views: 10481

Re: How to use non blocking functions, asynchronous tasks

@pythoncoder, Perhaps I could use your experience and knowledge. How can I simultaneously run two loops using uasyncio, something similar to _thread? Example with _thread: import _thread as th def loop1(): while True: #do something def loop2(): while True: #do something else th.start_new_thread(loop...
by zedtech
Sat Dec 09, 2017 2:23 am
Forum: ESP8266 boards
Topic: how can I implement time scheduling in micropython
Replies: 13
Views: 3971

Re: how can I implement time scheduling in micropython

@pythoncoder, Thanks again for those pointers and i have taken them into account and made changes, that's I converted all the the times I'm working with into seconds, saved as integers. I now get it, your point is about precision comparison. As per code in my last reply, would you know as to why the...
by zedtech
Fri Dec 08, 2017 7:52 pm
Forum: MicroPython pyboard
Topic: Anyone got wifi modules working with this board?
Replies: 3
Views: 1325

Re: Anyone got wifi modules working with this board?

hello, I used the esp-01(ESP8266) as the wifi module and everything is working fine for me. This module connects to the pyboard using uart module and its mode is AP, but can be configured as a station or the combination of both. Below is my code example import pyb from pyb import delay Led_Red, Led_...
by zedtech
Fri Dec 08, 2017 1:50 am
Forum: ESP8266 boards
Topic: how can I implement time scheduling in micropython
Replies: 13
Views: 3971

Re: how can I implement time scheduling in micropython

Its a pause and the code still works without it. I just followed the suggestion of someone and by adding it to my code thought it would clear up the issue with my code, but the issue was something else.
by zedtech
Thu Dec 07, 2017 8:12 pm
Forum: ESP8266 boards
Topic: how can I implement time scheduling in micropython
Replies: 13
Views: 3971

Re: how can I implement time scheduling in micropython

Once again thanks very much for your help. My actual entire code in the while loop on the ESP8266 had other parts besides of the time comparison. when i remove it, the time comparison worked. But i want to keep the other part too. How can this be done? Any suggestions will be highly appreciated. Her...