-->
Page 1 of 1

Sending serial data to web

PostPosted: Sun May 21, 2017 3:30 pm
by summersab
Yes, I'm new. I've never touched an Arduino, and I dove right into the standalone ESP8266. My C skills are a little rusty, but I'm making progress.

This is really a n00b data type question, but I'll go into a little detail. What I'm basically trying to do is send alphanumeric serial information from a device to a web page (right now, the "device" is me typing "bologna" into the serial monitor). I've started by trying to combine the BasicHttpClient and WiFiTelnetToSerial examples. In the WiFiTelnetToSerial code, instead of the code for //push UART data to all connected telnet clients, I want to push the data to a web address - likely PHP on a server somewhere. If successful, the PHP will respond indicating success. Otherwise (if fail or no response after, say, five seconds), the ESP stores the serial data until the next time it receives information from the device. Then, it tries again.

Let me just tackle the first part. Borrowing from the example code:
Code: Select allHTTPClient http;
//check UART for data
if(Serial.available()){
  size_t len = Serial.available();
  uint8_t sbuf[len];
  Serial.readBytes(sbuf, len);
  http.begin("http://something.com/dataCollector.php?value=" + sbuf); //<<This isn't a thing
  http.GET();
}


Pretty simply, how do I get the uint8_t variable into the http request? I know that using strings would require too much overhead, but I've been casting, converting, and Googling to try to get the serial data into a format that works. What am I missing?