Monday, December 8, 2008

Arduino Wiznet Webserver code

Yes Virginia, you can have a webserver in 14K of memory (that's K as in thousand not gig or meg)

I couldn't find any example code for making a web server with the Arduino 12 IDE - so I knuckled down and struggled through writing my own, and learned a LOT in the meantime. This example displays all the analog pin's values, and lets you set the Digital output pins on or off.  Its HTML web code so it is necessarily messy.  There are comments, such that they are, to try and shed some light on the process.

The Wiznet can deal with more than one connection,  so I had to make sure that any new page got what the current digital pins values. But had to sacrifice the ability to turn all the pins off.

HTML is a bite, and to truly do something that would be useful it would need a telnet connection so we could get some dedicated two way communication - and or a little AJAX code in the browser page to update things in real time.... That is for another day. 

If you change the code - make it more useful - do me a favor and drop me a line letting me know. I'll practice now heaping praise - ohhh awwww - fantastic!!!!

Hope its helps someone....
the code is here


KK4HFJ said...

This may have worked in 2008, but it's broken now. All Instances of Client Client need to be EthernetClient Client, Servber Server need to be EthernetServer, #include is missing, and EthernetServer server (80); is now the correct syntax for the port setting.

KK4HFJ said...

Here is the updated code for new versions of the IDE.