did a lot. upto activation working (exklusive config save)
This commit is contained in:
1 parent
1f6d92a54c
commit
148928f88c
38 files changed
+1095
-128
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import network
|
||||
import time
|
||||
import socket
|
||||
|
||||
ssid="Growsystem"
|
||||
password="12345678"
|
||||
|
||||
def web_page():
|
||||
html = """<html><head><meta name="viewport" content="width=device-width, initial-scale=1"></head>
|
||||
<body><h1>Hello World</h1></body></html>
|
||||
"""
|
||||
return html
|
||||
|
||||
# if you do not see the network you may have to power cycle
|
||||
# unplug your pico w for 10 seconds and plug it in again
|
||||
def ap_mode(ssid, password):
|
||||
"""
|
||||
Description: This is a function to activate AP mode
|
||||
|
||||
Parameters:
|
||||
|
||||
ssid[str]: The name of your internet connection
|
||||
password[str]: Password for your internet connection
|
||||
|
||||
Returns: Nada
|
||||
"""
|
||||
# Just making our internet connection
|
||||
ap = network.WLAN(network.AP_IF)
|
||||
ap.config(essid=ssid, password=password)
|
||||
ap.active(True)
|
||||
|
||||
while ap.active() == False:
|
||||
pass
|
||||
print('AP Mode Is Active, You can Now Connect')
|
||||
print('IP Address To Connect to:: ' + ap.ifconfig()[0])
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #creating socket object
|
||||
s.bind(('', 80))
|
||||
s.listen(5)
|
||||
|
||||
while True:
|
||||
conn, addr = s.accept()
|
||||
print('Got a connection from %s' % str(addr))
|
||||
request = conn.recv(1024)
|
||||
print('Content = %s' % str(request))
|
||||
response = web_page()
|
||||
conn.send(response)
|
||||
conn.close()
|
||||
|
||||
ap_mode('Growsystem95','PASSWORD')
|
||||
Reference in new issue
Block a user