micropython nodemcu webpage problem

Thread Starter

yef smith

Joined Aug 2, 2020
717
Hello,i have used micropython to create wifi accsses point as shown bellow.It works.
I lack the definition of the web page design.
My goal is to connect the network shown bellow,then enter an IP address into the webpage and see a variable printed on the web page.
I tried to use this manual but its too complicated i entered the code ,and its not connecting to the web page ,although i connected to the WIFI network.
I need a command for defining IP and a command for printing variables on the webpage.
Is there some one who can reccomnd me a source?
Thanks.
https://randomnerdtutorials.com/esp32-esp8266-micropython-web-server/

Code:
ap_if = network.WLAN(network.AP_IF)
ssid = 'MicroPython-AP23'
password = '123456789'
ap_if.active(True)
ap_if.config(essid=ssid, password=password)
 

Thread Starter

yef smith

Joined Aug 2, 2020
717
Hello Ian, that is the point got so far.I have succseeded defining the HOTSPOT but i dont know how to present on the webpage of the IP a value of a variable.
Is there some setting regarding it?

1608206055610.png
 

Thread Starter

yef smith

Joined Aug 2, 2020
717
Hello Ian, I have managed to asemble the following code shown bellow,with socket as shown below
i enter the wifi network,then i write the IP adrress( i tried them both) and nothing.

1608237526349.png
Code:
import network
import usocket as socket
ap_if = network.WLAN(network.AP_IF)
ssid = 'MicroPython-AP29'
password = '123456789'
ap_if.active(True)
ap_if.config(essid=ssid, password=password)

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(('',80))
s.listen(5)
while True:
    conn, addre=s.accept()
    request=conn.recv(1024)
    request=str(request)
    response="gyhkjgku"
    conn.send("HTTP/1.1 200 OK\n")
    conn.send("Content-type: text/html\n")
    conn.send("Connection: close\n\n")
    conn.sendall(response)
    conn.close()
 
Top