ovidiucp / TinyWebServer

Small web server for Arduino, fits in 10KB ROM, less than 512 bytes RAM
http://www.webweavertech.com/ovidiu/weblog/archives/000484.html
GNU Lesser General Public License v2.1
245 stars 65 forks source link

Put variable #18

Open overload08 opened 11 years ago

overload08 commented 11 years ago

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

ovidiucp commented 11 years ago

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.

technobly commented 11 years ago

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.

ovidiucp commented 11 years ago

@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.