blub
This commit is contained in:
parent
fa9fd15fae
commit
52da15e574
1 changed files with 13 additions and 11 deletions
|
|
@ -5,6 +5,7 @@ import select
|
|||
import neopixel
|
||||
from machine import Pin
|
||||
import errno
|
||||
import machine
|
||||
|
||||
def do_connect(tries=0):
|
||||
if tries > 3:
|
||||
|
|
@ -33,22 +34,23 @@ def do_connect(tries=0):
|
|||
def do_ap():
|
||||
ap_if = network.WLAN(network.WLAN.IF_AP)
|
||||
ap_if.active(True)
|
||||
ap_if.config(ssid='My AP123', channel=13, key='asdf1234')
|
||||
ap_if.config(ssid='My AP123', channel=11, key='asdf1234')
|
||||
ap_if.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
|
||||
print(ap_if.config('ssid'))
|
||||
print(ap_if.config('channel'))
|
||||
print('AP ready.')
|
||||
|
||||
# wait for someone to connect
|
||||
for i in range(30):
|
||||
if ap_if.isconnected():
|
||||
print('Client connected')
|
||||
return
|
||||
time.sleep(1)
|
||||
if False:
|
||||
# wait for someone to connect
|
||||
for i in range(60):
|
||||
if ap_if.isconnected():
|
||||
print('Client connected')
|
||||
return
|
||||
time.sleep(1)
|
||||
|
||||
# reset device
|
||||
print('Timeout waiting for client. Resetting device..')
|
||||
machine.reset()
|
||||
# reset device
|
||||
print('Timeout waiting for client. Resetting device..')
|
||||
machine.reset()
|
||||
|
||||
|
||||
def setup_listener():
|
||||
|
|
@ -157,7 +159,7 @@ def mainloop(l):
|
|||
print('RCV: ', a)
|
||||
y.write(a)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EWOULDBLOCK or e.errno == errno.EAGAIN:
|
||||
if e.errno == errno.ETIMEDOUT or e.errno == errno.EAGAIN:
|
||||
# timeout
|
||||
a = b'x'
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue