File tree 2 files changed +10
-6
lines changed 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,13 @@ def read(self, n=-1):
164
164
# PollEventLoop._unregister
165
165
return res # Next iteration raises StopIteration and returns result
166
166
167
+ def readinto (self , buf , n = - 1 ): # Experimental and not yet tested TODO
168
+ yield IORead (self .polls )
169
+ res = self .ios .readinto (buf , n )
170
+ assert res , 'zero bytes returned' # Temporary
171
+ yield IOReadDone (self .polls )
172
+ return res
173
+
167
174
def readexactly (self , n ):
168
175
buf = b""
169
176
while n :
Original file line number Diff line number Diff line change 6
6
# On my SF_2W board consumption while paused was 170μA.
7
7
8
8
# Test reception e.g. with:
9
- # mosquitto_sub -h 192.168.0.33 -t result
10
-
11
- SERVER = '192.168.0.33' # *** Adapt for local conditions ***
12
- SSID = 'misspiggy'
13
- PW = '6163VMiqSTyx'
9
+ # mosquitto_sub -h 192.168.0.10 -t result
14
10
15
11
import rtc_time_cfg
16
12
rtc_time_cfg .enabled = True
19
15
from umqtt .simple import MQTTClient
20
16
import network
21
17
import ujson
18
+ from local import SERVER , SSID , PW # Local configuration: change this file
22
19
23
20
import uasyncio as asyncio
24
21
try :
@@ -42,7 +39,7 @@ async def main(loop):
42
39
sta_if = network .WLAN ()
43
40
sta_if .active (True )
44
41
sta_if .connect (SSID , PW )
45
- while sta_if .status () == 1 :
42
+ while sta_if .status () in ( 1 , 2 ): # https://github.com/micropython/micropython/issues/4682
46
43
await asyncio .sleep (1 )
47
44
grn .toggle ()
48
45
if sta_if .isconnected ():
You can’t perform that action at this time.
0 commit comments