fixed type error causing bootloop
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
#include "headerFile.h"
|
||||
|
||||
// SensorManager::Rotation offset;
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
#define DEVICE_ID 1
|
||||
|
||||
char *buffer = (char *)malloc(sizeof(char) * BUFFER_SIZE);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
// Serial.begin(9600);
|
||||
// Serial.println("startup");
|
||||
//connect to internet and start sensor
|
||||
connectivity.connectWiFi(ssid, pass);
|
||||
sensorManager.sensorSetup();
|
||||
}
|
||||
|
||||
unsigned long lastTime = 0; // will store the last time the code was run
|
||||
|
||||
void loop() {
|
||||
SensorManager::eulerAngles eulerRotation = sensorManager.getEulerAngles();
|
||||
SensorManager::acceleration rotationAcceleration = sensorManager.getAcelleration();
|
||||
unsigned long lastTime = 0; // will store the last time the code was run
|
||||
|
||||
unsigned long currentTime = millis();
|
||||
if (currentTime - lastTime >= 100) { // 100 ms has passed
|
||||
memset(buffer, 0, BUFFER_SIZE);
|
||||
sprintf(
|
||||
buffer,
|
||||
"{\"deviceId\": %d, \"rotationX\": %d, \"rotationY\": %d, \"rotationZ\": %d, \"accelerationX\": %d, \"accelerationY\": %d, \"accelerationZ\": %d, \"type\": %s}",
|
||||
"{\"deviceId\": %d, \"rotationX\": %f, \"rotationY\": %f, \"rotationZ\": %f, \"accelerationX\": %f, \"accelerationY\": %f, \"accelerationZ\": %f, \"type\": %s}",
|
||||
DEVICE_ID,
|
||||
eulerRotation.roll,
|
||||
eulerRotation.pitch,
|
||||
@@ -34,8 +30,7 @@ void loop() {
|
||||
rotationAcceleration.y,
|
||||
rotationAcceleration.z,
|
||||
"data");
|
||||
// Serial.println(connectivity.httpPost("192.168.137.45", "/", 3445, message.c_str(), message.length(), "json"));
|
||||
// Serial.println(message);
|
||||
// %d = int, %f = floatation, %s = string
|
||||
connectivity.httpPost("192.168.137.45", "/", 3445, buffer, strlen(buffer), "application/json");
|
||||
lastTime = currentTime;
|
||||
}
|
||||
|
Reference in New Issue
Block a user