29 lines
872 B
C++
29 lines
872 B
C++
#include "headerFile.h"
|
|
|
|
// SensorManager::Rotation offset;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
Serial.println("startup");
|
|
//connect to internet and start sensor
|
|
connectivity.connectWiFi(ssid, pass);
|
|
sensorManager.sensorSetup();
|
|
|
|
}
|
|
|
|
void loop() {
|
|
SensorManager::eulerAngles eulerRotation = sensorManager.getEulerAngles();
|
|
|
|
Serial.print(eulerRotation.roll);
|
|
Serial.print(" ");
|
|
Serial.print(eulerRotation.pitch);
|
|
Serial.print(" ");
|
|
Serial.print(eulerRotation.yaw);
|
|
Serial.println();
|
|
|
|
String message = "{\"Sensor\": 1, \"roll\":\"" + String(eulerRotation.roll) + "\",\"pitch\":\"" + String(eulerRotation.pitch) + "\",\"yaw\":\"" + String(eulerRotation.yaw) + "\"}";
|
|
int messageLength = message.length();
|
|
Serial.println(message);
|
|
Serial.println(connectivity.httpPost("192.168.137.146", "/", 3445, message.c_str(), message.length(), "json"));
|
|
}
|