🚚 Moves from rust to go
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import network
|
||||
import utime
|
||||
from machine import Pin
|
||||
|
||||
control_button = Pin(16, Pin.IN)
|
||||
led = Pin("LED", Pin.OUT)
|
||||
test_mode = False
|
||||
|
||||
# in the first five seconds, we want to give the
|
||||
# sysadmin an option to enter standby test mode
|
||||
for _ in range(50):
|
||||
print(control_button.value())
|
||||
if control_button.value():
|
||||
test_mode = True
|
||||
print("Entering test mode")
|
||||
break
|
||||
|
||||
led.toggle()
|
||||
utime.sleep_ms(100)
|
||||
|
||||
|
||||
if test_mode:
|
||||
while True:
|
||||
led.toggle()
|
||||
utime.sleep_ms(500)
|
||||
|
||||
|
||||
ssid = 'HUAWEI-2EEt-2G'
|
||||
password = 'hxtU2dvx'
|
||||
|
||||
|
||||
|
||||
def connect():
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
wlan.connect(ssid, password)
|
||||
while not wlan.isconnected():
|
||||
print("Waiting for connection...")
|
||||
for _ in range(4):
|
||||
led.toggle()
|
||||
utime.sleep_ms(250)
|
||||
|
||||
led.on()
|
||||
print(wlan.ifconfig())
|
||||
|
||||
|
||||
connect()
|
||||
Reference in New Issue
Block a user