Question

I have above average html experience, and have also dabbled with a bit of PHP as well.

I am now getting into Arduino and have connected it to the internet via an Ethernet module.

The issue is the Arduino doesn't have much memory (30KB !!) so having PHP to handle server-side code is out of the question and multiple pages might also be difficult (maybe not possible even).

Obviously this will get into C++ territory which is even further down the rabbit hole, but i would appreciate if anybody could give me some pointers as to which way to dig down instead of having to cover the full basics of C++ (using Arduino has "spoiled" me, i guess).

There are various libraries which help with doing the grunt work as far as coding goes, but i'm having trouble trying to figure out which parts of a library does what, as well as trying to translate between the different methods of each particular library - one certainly needs to know C++ to be able to read the different libraries.

One tutorial showed the possibility for a button to be placed on the page like so;

<form METHOD=get action=" (*(baseurl)*) ">
<input type=hidden name=**cmd** value=1>
<input type=submit value="LED Off">
</form>

<form METHOD=get action=" (*(baseurl)*) ">
<input type=hidden name=**cmd** value=2>
<input type=submit value="LED On">
</form>

but the library itself is now defunct, and i can't figure out where the value of 'cmd' would be used within the newer library that i now use.

Here is some code remnants that was still on the tutorial page;

if ((cmd==1)||(cmd==2)){ 
         if (cmd==1)
           {LEDOnOff(0);delay(100);}
           else
           {LEDOnOff(1);delay(100);};
         plen=print_webpage(buf);
    }

es.ES_make_tcp_ack_from_any(buf); // send ack for http get
es.ES_make_tcp_ack_with_data(buf,plen); // send data

In PHP it would be easy to handle it with the GET method, but now i'm baffled how to "catch" that 'cmd' value with just C++.

If anyone is aware of the EtherCard library, that's what i'm using - and i could post the relevant .cpp file or functions therein if i knew what sort of keywords i should be looking for.

Could anybody give hints as to what sort of methods could be employed to make a sparse interactive webpage ? There are examples with 'refresh' as well as displaying information about sensors connected to the Arduino - but none that seem to show how a user/client could interact, aside from that old library with the example mentioned above.

No correct solution

OTHER TIPS

This question was apparently an 'alias' for "How to write a webserver or do HTTP programming in C++" of which there are many threads on SO with the various suggestions on libraries one can use such as libcurl, netlib and boost-asio.

The learning experience continues, and this question is now answered as a stepping stone to "where to go next to reply the question".

i don't know if we're allowed to cross-link to other questions but here are the links that helped me to get closer to the answer to my question;

Build a simple HTTP server in C

Simple webserver in C++?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top