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