ESP8266 access point server

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
moetaz
Posts: 39
Joined: Sun Oct 31, 2021 11:33 am

ESP8266 access point server

Post by moetaz » Sun Oct 31, 2021 11:38 am

Hello

can any one help me
how can run the css file and javascript file on the board esp8266

i building small webserver contain 3 html file and css file and javascript file

when i put the device in access point
the css file not loading or even the other html file or javascript

how i can create the link with micropython between the project pages

bitninja
Posts: 165
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: ESP8266 access point server

Post by bitninja » Sun Oct 31, 2021 4:47 pm

Hello!

You will also need some sort of web server application to serve your page.

See here...

https://awesome-micropython.com/#web

HTH

moetaz
Posts: 39
Joined: Sun Oct 31, 2021 11:33 am

Re: ESP8266 access point server

Post by moetaz » Sun Oct 31, 2021 5:22 pm

i had do the same idea but throw arduino

i just write below senetce to make the server see and collect all other html and css js file

server.serveStatic("/",SPIFFS, "/");

in micropython we don't have the same ????

bitninja
Posts: 165
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: ESP8266 access point server

Post by bitninja » Sun Oct 31, 2021 6:26 pm

Even Arduino requires you to include some sort of web server.

moetaz
Posts: 39
Joined: Sun Oct 31, 2021 11:33 am

Re: ESP8266 access point server

Post by moetaz » Sun Oct 31, 2021 6:35 pm

this wad my arduino code and the css file and js was working fine

server.serveStatic("/",SPIFFS, "/");

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/html", index_html, processor);
});
server.on("/temperaturec", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", temperatureC.c_str());
});
server.on("/chart", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/chart.html");
});
server.on("/table", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/table.html");
});
// Start server
server.begin();

how can make it in micropython as all example on interent depending on simple webserver using function include html main code
in the main.py file

honestly i got tired i read alot alot

i hope to fine simple and easy solution

moetaz
Posts: 39
Joined: Sun Oct 31, 2021 11:33 am

Re: ESP8266 access point server

Post by moetaz » Sun Oct 31, 2021 6:38 pm

and for sure in socket library that already exist in micropython
they have sort of code to can load the css file and make routing for the website pages

moetaz
Posts: 39
Joined: Sun Oct 31, 2021 11:33 am

Re: ESP8266 access point server

Post by moetaz » Sun Oct 31, 2021 10:06 pm

thank you bitninja

i make it

moetaz
Posts: 39
Joined: Sun Oct 31, 2021 11:33 am

Re: ESP8266 access point server

Post by moetaz » Sun Oct 31, 2021 11:56 pm

thank you i do it

but i face another problem
javascript not work well on the server
always receive error [Errno 110] ETIMEDOUT

any suggestion

i use java to draw chart from 3000 record stored in the esp8266

can you advice library can do chart and produce pdf file and work on esp8266

Post Reply