kopia lustrzana https://github.com/pimoroni/pimoroni-pico
remove out of date upip install code
rodzic
9a613975d7
commit
69ee5cff3a
|
@ -5,12 +5,15 @@ import WIFI_CONFIG
|
||||||
from network_manager import NetworkManager
|
from network_manager import NetworkManager
|
||||||
import uasyncio as asyncio
|
import uasyncio as asyncio
|
||||||
import uasyncio.core
|
import uasyncio.core
|
||||||
|
from tinyweb.server import webserver
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Display scrolling wisdom, quotes or greetz.
|
Display scrolling wisdom, quotes or greetz... from the internetz!
|
||||||
|
|
||||||
You can adjust the brightness with LUX + and -.
|
You can adjust the brightness with LUX + and -.
|
||||||
|
|
||||||
|
Requires network_manager.py , WIFI_CONFIG.py, logging.mpy and tinyweb from micropython/examples/common
|
||||||
|
You'll also need index.html to be saved alongside this file.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Server Settings
|
# Server Settings
|
||||||
|
@ -56,24 +59,9 @@ def status_handler(mode, status, ip):
|
||||||
print("IP: {}".format(ip))
|
print("IP: {}".format(ip))
|
||||||
MESSAGE = "{}".format(ip)
|
MESSAGE = "{}".format(ip)
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
from tinyweb.server import webserver
|
|
||||||
|
|
||||||
except ImportError:
|
|
||||||
# WIFI settings
|
|
||||||
WIFI_COUNTRY = "GB" # Changeme!
|
|
||||||
network_manager = NetworkManager(WIFI_COUNTRY, status_handler=status_handler)
|
|
||||||
uasyncio.get_event_loop().run_until_complete(network_manager.client(WIFI_CONFIG.SSID, WIFI_CONFIG.PSK))
|
|
||||||
# Install missing module
|
|
||||||
import upip
|
|
||||||
upip.install('logging')
|
|
||||||
from tinyweb.server import webserver
|
|
||||||
|
|
||||||
# Create web server application
|
# Create web server application
|
||||||
app = webserver()
|
app = webserver()
|
||||||
|
|
||||||
|
|
||||||
# Static page
|
# Static page
|
||||||
html_file = open('index.html', 'r')
|
html_file = open('index.html', 'r')
|
||||||
|
|
||||||
|
@ -201,7 +189,7 @@ async def message_update():
|
||||||
await asyncio.sleep(0.001)
|
await asyncio.sleep(0.001)
|
||||||
|
|
||||||
|
|
||||||
# The folloing is required to run both the web server and the scrolling text coherantly
|
# The following is required to run both the web server and the scrolling text coherently
|
||||||
app._server_coro = app._tcp_server(host, port, app.backlog)
|
app._server_coro = app._tcp_server(host, port, app.backlog)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
t1 = loop.create_task(message_update())
|
t1 = loop.create_task(message_update())
|
||||||
|
|
Ładowanie…
Reference in New Issue