Skip to content

Instantly share code, notes, and snippets.

@palaniraja
Created July 20, 2014 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palaniraja/b1efc4b55bdab001e545 to your computer and use it in GitHub Desktop.
Save palaniraja/b1efc4b55bdab001e545 to your computer and use it in GitHub Desktop.
Post values from sparkcore
// Message to post
char msg[] = "Message from spark core";
#include <string.h>
#define LIB_DOMAIN "mighty-island-9691.herokuapp.com"
TCPClient client;
// EXAMPLE USAGE
//http://mighty-island-9691.herokuapp.com/?val=valueFromDevice
void setup()
{
delay(1000);
// or you can use DHCP for autoomatic IP address configuration.
// Ethernet.begin(mac);
Serial.begin(9600);
Serial.println("connecting .test..");
client.connect(LIB_DOMAIN, 80);
client.println("GET / HTTP/1.0");//or change it to POST instead of GET
client.println("Host: " LIB_DOMAIN);
//client.print("Content-Length: ");
//client.println(strlen(msg)+strlen(TOKEN)+14);
client.println();
client.print("&val=");
client.println(msg);
}
void loop()
{
Serial.println("connecting .test");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment