TinyWebServer icon indicating copy to clipboard operation
TinyWebServer copied to clipboard

Put variable

Open overload08 opened this issue 11 years ago • 3 comments

Can i put some arduino variables into web pages stored in SD card?

overload08 avatar May 30 '13 18:05 overload08

I'm not sure I understand your use case. Are you thinking of storing application data in files stored on the SD card? If so, yes, you should be able to.

ovidiucp avatar May 30 '13 19:05 ovidiucp

I think he means data injection like AngularJS or Jade can do. For example, a webpage that tells you the current state of a pin, not necessarily real time updating like AngularJS would be able to do... but just on page load. I think you could make a nice simple web app on this tinywebserver that used AngularJS and a RESTful API that would be used to relay variable data.

technobly avatar Aug 18 '13 20:08 technobly

@DubbyTT The BlinkLED example uses exactly that use case, except it's using jQuery instead of AngularJS. See the ledStatus function in examples/BlinkLed/static/main.js, which makes a request to the Arduino web server, asking for the status of the LED. The function on the Arduino that gets executed is led_status_handler in examples/BlinkLed/BlinkLed.ino.

If you want to use AngularJS, you'd need to return a JSON in the led_status_handler, and obviously modify write the AngularJS code.

ovidiucp avatar Aug 19 '13 01:08 ovidiucp