Hi Forum,
I have been looking around for a solution/example for my problem, but haven't been able to find one out there, so hopefully some helpful Arduino experts in here can give me some tips, link or snippets I can use to solve my problem.
My HW: Arduino board (mega) and an ethernetshield (wired with SD card)
First a bit about my project: I would like to exchange data between my Arduino and a webpage via and XML file, both web page and XML file is stored on a SD card. This first part I got working, reading the XML file from the SD card and sending it to the webpage when it is requested, all this is via the Arduino used as my web server, and using the on board SD card slot on the ethernet shield.
I have seen this example: Arduino Webserver Input and Output but unfortunately it is limited to only a couple of signals to be exchanged between Arduino and a webpage, and the XML file is not stored on the SD card.
The data I want to exchange is approx 200 groups, which each contain 5 variables and my XML is setup so it correspond to this, see below.
<?xml version = "1.0" ?>
<data>
<group name="1">
<variable id1="on" id2="on" id3="off" id4="on" id5="off" />
</group>
<group name="2">
<variable id1="on" id2="on" id3="off" id4="on" id5="off" />
</group>
<group name="3">
<variable id1="on" id2="on" id3="off" id4="on" id5="off" />
</group>
.
.
.
.
<group name="200">
<variable id1="on" id2="on" id3="off" id4="on" id5="off" />
</group>
</data>
My problem is, I want to update a single variable in one of the groups, say e.g. I want to update variable id3 in group 156 from "on" to "off". How to do that in the XML file stored on the SD card. I have been able to read the XML file into a String object in Arduino, but how do I find variable 3 in group 156 and only change the value for this and the save the XML file back to the SD card, so next time the webpage request the XML file it will receive the updated XML file.
Does any one here in the forum have an easy way to achieve this, maybe a XML library that can help with doing these operations, or maybe have another idea how to exchange (big amount) of data between Arduino and a webpage.
Thanks