-->
Page 1 of 2

SD web server interaction

PostPosted: Mon Jan 02, 2017 12:24 pm
by Lawmate
Hi

This may seem like a dumb question, but after playing around with using the esp12 to serve up a web page from an SD card, I've hit a wall. I've been the using the SDWebServer example that is in the Arduino IDE.

What I eventually want to do is serve a web page that acts as an interface for the client to control the esp12 sending out another file over serial. So in the web page there is a list of all the data files stored on the SD card and the user can select one, then the esp12 reads the data off the file and sends it out using the software serial library to another device.

What I'm struggling with is how and where to code this from. I currently have a .htm web page that contains some .js files that are written with p5.js. I have created those in isolation from the esp12, basically coding them on my desktop, then transferring them to the SD card. I have 3 pages each with their own p5.js file and all linking to one another.

How would I structure it so that some event happening on the web page (I assume written either in the .htm or .js files) would trigger some function written on the esp12?

Many thanks

Re: SD web server interaction

PostPosted: Tue Jan 03, 2017 1:08 pm
by mrburnette
You may find some useful code in one/more of my ESP8266 projects; This one is AJAX and uses a slider control to change the blink rate.
https://www.hackster.io/rayburne/esp8266-webserver-using-javascript-and-xml-aa78f1


Ray
All Projects

Re: SD web server interaction

PostPosted: Wed Jan 04, 2017 6:59 am
by Lawmate
Great, thanks!

I got your example working then backtracked to the example from katz earlier in the thread that just displays run time on the web page. I combined that code with the SD server code so the HTML and javascript are saved as a stand alone .htm file and are served from the SD card and the XML stays coded on the esp.

This is heading in the right direction for where I want to go and is definitely in manageable steps. I come from an electronics background and don't have much experience with web coding. Learning how all the different languages interact with one another and why certain languages are used for certain functions and not others takes a bit of time!

Anyway, much appreciate the pointers!

Thanks

Re: SD web server interaction

PostPosted: Wed Jan 04, 2017 10:24 am
by mrburnette
I come from an electronics background and don't have much experience with web coding.


Same.
Web technologies are moving targets ... not just put/get anymore! Hopefully HTML5, javascript, and XML will solve most of the future issues but there is always someone that thinks a new protocol or interface or handler is going to be needed. As a EE, I view this web-stuff as the old joke about the VP of Advertising running into the research center shouting, "I have a new slogan, now we need a matching product..."

Ray