chore: Update Connectivity class with fetchIPAddress method

This commit is contained in:
Niels Gras
2024-05-31 16:32:06 +02:00
parent 3db278f92c
commit b9b4a9ca9b
3 changed files with 42 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ void setup() {
//connect to internet and start sensor
connectivity.connectWiFi(ssid, pass);
sensorManager.sensorSetup();
Serial.begin(9600);
}
unsigned long lastTime = 0; // will store the last time the code was run
@@ -12,7 +13,6 @@ void loop() {
SensorManager::eulerAngles eulerRotation = sensorManager.getEulerAngles();
// SensorManager::acceleration rotationAcceleration = sensorManager.getAcelleration();
struct acceleration {
float x = 9;
float y = 9;
@@ -34,7 +34,7 @@ struct acceleration {
accelData.z,
"data");
// %d = int, %f = floatation, %s = string
connectivity.httpPost("192.168.137.243", "/", 3445, buffer, strlen(buffer), "application/json");
connectivity.httpPost(connectivity.fetchIPAddress(), "/", 3445, buffer, strlen(buffer), "application/json");
lastTime = currentTime;
}
}