Hello,
I am sending data to cloud server by using esp8266. For sending data to cloud server I am using inline c. It is sending the data successsfully.
How to assign the value at the variable Temperature and humidity in inline C/C++???, I received from AsyncStream from Arduino.
Below I am receiving data from Arduino to ESP8266 end....
I am sending data to cloud server by using esp8266. For sending data to cloud server I am using inline c. It is sending the data successsfully.
B4X:
#if C
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
void setup(B4R::Object* o){
const char *host = "http://mypage.com";
}
void read (B4R::Object* o) {
HTTPClient http; //Declare object of class HTTPClient
String temperature, humidity, getData, Link;
//String getData, Link;
temperature="77.77"; <--- Here I hardcoded the value
humidity="99.99"; <----Here I hardcoded the value
//GET Data
getData = "?temperature=" + temperature + "&humidity=" + humidity ; //Note "?" added at front
Link = "http://mypage.com/addTemperature.php" + getData;
http.begin(Link); //Specify request destination
int httpCode = http.GET(); //Send the request
String payload = http.getString(); //Get the response payload
Serial.println(httpCode); //Print HTTP return code
Serial.println(payload); //Print request response payload
http.end(); //Close connection
}
#End if
How to assign the value at the variable Temperature and humidity in inline C/C++???, I received from AsyncStream from Arduino.
Below I am receiving data from Arduino to ESP8266 end....
B4X:
Public Astream As AsyncStreams
Private ser As B4RSerializator
Private BE(20) As Object
Private Sub Arduino_Received_Data(buffer() As Byte)
ser.ConvertBytesToArray(buffer,BE)
Log("Humid from Ardiono :",BE(0))
Log("Temp from Arduino :",BE(1))
Log("Length of Buffer Array : ", buffer.Length)
End Sub