Merge pull request 'microdot-integration' (#8) from microdot-integration into main
All checks were successful
All checks were successful
Reviewed-on: #8 Reviewed-by: Matthias Blankertz <matthias@blankertz.org>
This commit was merged in pull request #8.
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
|||||||
[submodule "software/lib/micropython-mfrc522"]
|
[submodule "software/lib/micropython-mfrc522"]
|
||||||
path = software/lib/micropython-mfrc522
|
path = software/lib/micropython-mfrc522
|
||||||
url = ../micropython-mfrc522.git
|
url = ../micropython-mfrc522.git
|
||||||
|
[submodule "software/lib/microdot"]
|
||||||
|
path = software/lib/microdot
|
||||||
|
url = ../microdot.git
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ require("sdcard")
|
|||||||
require("aiorepl")
|
require("aiorepl")
|
||||||
|
|
||||||
module("mfrc522.py", "../../lib/micropython-mfrc522/")
|
module("mfrc522.py", "../../lib/micropython-mfrc522/")
|
||||||
|
module("microdot.py", "../../lib/microdot/src/microdot/")
|
||||||
|
|||||||
1
software/lib/microdot
Submodule
1
software/lib/microdot
Submodule
Submodule software/lib/microdot added at d864b81b65
38
software/src/microdot/main.py
Normal file
38
software/src/microdot/main.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import rp2
|
||||||
|
import network
|
||||||
|
import ubinascii
|
||||||
|
from microdot import Microdot
|
||||||
|
|
||||||
|
rp2.country('DE')
|
||||||
|
|
||||||
|
wlan = network.WLAN(network.AP_IF)
|
||||||
|
wlan.config(ssid='TonberryPico', security=network.WLAN.SEC_OPEN)
|
||||||
|
# Important: we cannot change the ip in station mode, otherwise dhcp won't work!
|
||||||
|
# wlan.ipconfig(addr4='10.0.0.1')
|
||||||
|
wlan.active(True) # loads the firmware
|
||||||
|
while wlan.active() is False:
|
||||||
|
pass
|
||||||
|
wlan.config(pm=network.WLAN.PM_NONE)
|
||||||
|
|
||||||
|
mac = ubinascii.hexlify(network.WLAN().config('mac'), ':').decode()
|
||||||
|
print(f" mac: {mac}")
|
||||||
|
print(f" channel: {wlan.config('channel')}")
|
||||||
|
print(f" essid: {wlan.config('essid')}")
|
||||||
|
print(f" txpower: {wlan.config('txpower')}")
|
||||||
|
print(f"ifconfig: {wlan.ifconfig()}")
|
||||||
|
|
||||||
|
app = Microdot()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
async def index(request):
|
||||||
|
print("wohoo, a guest :)")
|
||||||
|
print(f" app: {request.app}")
|
||||||
|
print(f" client: {request.client_addr}")
|
||||||
|
print(f" method: {request.method}")
|
||||||
|
print(f" url: {request.url}")
|
||||||
|
print(f" headers: {request.headers}")
|
||||||
|
print(f" cookies: {request.cookies}")
|
||||||
|
return "TonberryPico says 'Hello World!'"
|
||||||
|
|
||||||
|
app.run(port=80)
|
||||||
Reference in New Issue
Block a user