From 3bb599428e8defe6ff05b3b72cd63eef978288ef Mon Sep 17 00:00:00 2001 From: Allison <67673392+Allybe@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:28:59 -0500 Subject: [PATCH] init --- .micropico | 3 +++ .vscode/extensions.json | 8 ++++++++ .vscode/settings.json | 15 +++++++++++++++ main.py | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .micropico create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 main.py diff --git a/.micropico b/.micropico new file mode 100644 index 0000000..008536b --- /dev/null +++ b/.micropico @@ -0,0 +1,3 @@ +{ + "info": "meow" +} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..fbc7999 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "ms-python.python", + "visualstudioexptteam.vscodeintellicode", + "ms-python.vscode-pylance", + "paulober.pico-w-go" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..03be782 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "python.languageServer": "Pylance", + "python.analysis.typeCheckingMode": "basic", + "python.analysis.diagnosticSeverityOverrides": { + "reportMissingModuleSource": "none" + }, + "python.terminal.activateEnvironment": false, + "micropico.openOnStart": true, + "python.analysis.typeshedPaths": [ + "~/.micropico-stubs/included" + ], + "python.analysis.extraPaths": [ + "~/.micropico-stubs/included" + ] +} \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..1c64e19 --- /dev/null +++ b/main.py @@ -0,0 +1,37 @@ +import time +import network +import urequests + +def sendDoorStatus(status): + requestURL = "http://10.69.70.1/status" + r = urequests.post(requestURL, data={"status", status}) + +def connectToNet(): + ssid = "ITRnet" + password = "pink4bubble" + + wlan = network.WLAN(network.STA_IF) + wlan.active(True) + wlan.connect(ssid, password) + + MAX_WIFI_CONNECT_WAIT = 30 + while MAX_WIFI_CONNECT_WAIT > 0: + if wlan.status() < 0 or wlan.status() >= 3: + break + MAX_WIFI_CONNECT_WAIT -= 1 + print('waiting to connect...') + time.sleep(1) + + if wlan.status() != 3: + raise RuntimeError('network connection failed') + else: + print('connected!') + status = wlan.ifconfig() + print('ip = ' + status[0]) + +# program + +connectToNet() +sendDoorStatus(False) + +