I have a:
Arduino Mega 2560
Ethernet Shield rev 3
Sensor
What i want to do is to host a webpage on the arduino , and periodicly make post request to ThingSpeak.
I'm confused how should i go with this. Should i make 2 ethernet clients?
Can somebody please post a example with the default arduino web server example and this POST request:
void updateThingSpeak(String tsData)
{
if (client.connect(thingSpeakAddress, 80))
{
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(tsData.length());
client.print("\n\n");
client.print(tsData);