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
|
import neopixel
|
||||||
from machine import Pin
|
from machine import Pin
|
||||||
import errno
|
import errno
|
||||||
|
import machine
|
||||||
|
|
||||||
def do_connect(tries=0):
|
def do_connect(tries=0):
|
||||||
if tries > 3:
|
if tries > 3:
|
||||||
|
|
@ -33,14 +34,15 @@ def do_connect(tries=0):
|
||||||
def do_ap():
|
def do_ap():
|
||||||
ap_if = network.WLAN(network.WLAN.IF_AP)
|
ap_if = network.WLAN(network.WLAN.IF_AP)
|
||||||
ap_if.active(True)
|
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'))
|
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('ssid'))
|
||||||
print(ap_if.config('channel'))
|
print(ap_if.config('channel'))
|
||||||
print('AP ready.')
|
print('AP ready.')
|
||||||
|
|
||||||
|
if False:
|
||||||
# wait for someone to connect
|
# wait for someone to connect
|
||||||
for i in range(30):
|
for i in range(60):
|
||||||
if ap_if.isconnected():
|
if ap_if.isconnected():
|
||||||
print('Client connected')
|
print('Client connected')
|
||||||
return
|
return
|
||||||
|
|
@ -157,7 +159,7 @@ def mainloop(l):
|
||||||
print('RCV: ', a)
|
print('RCV: ', a)
|
||||||
y.write(a)
|
y.write(a)
|
||||||
except OSError as e:
|
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
|
# timeout
|
||||||
a = b'x'
|
a = b'x'
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue