send data in json format
This commit is contained in:
@@ -32,9 +32,7 @@ void loop() {
|
|||||||
Serial.print(pitch);
|
Serial.print(pitch);
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(yaw);
|
Serial.print(yaw);
|
||||||
sendData(String(roll));
|
sendData(roll, pitch, yaw);
|
||||||
sendData(String(pitch));
|
|
||||||
sendData(String(yaw));
|
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
webSocket.loop();
|
webSocket.loop();
|
||||||
@@ -61,6 +59,7 @@ void websocketSetup(){
|
|||||||
webSocket.setReconnectInterval(500);
|
webSocket.setReconnectInterval(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendData(String textString){
|
void sendData(float roll, float pitch, float yaw){
|
||||||
webSocket.sendTXT(textString);
|
String message = "{\"Sensor\": 1, \"roll\":\"" + String(roll) + "\",\"pitch\":\"" + String(pitch) + "\",\"yaw\":\"" + String(yaw) + "\"}";
|
||||||
}
|
webSocket.sendTXT(message);
|
||||||
|
}
|
Reference in New Issue
Block a user