Created
July 20, 2014 13:02
-
-
Save palaniraja/b1efc4b55bdab001e545 to your computer and use it in GitHub Desktop.
Post values from sparkcore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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