Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Hey guys @Middleware & OS @MCU, MPU & Firmware , I am attempting to set up an ESP32 to collect vibration data using an ADXL335 accelerometer and send it to a server for predictive maintenance analysis. The data should be transmitted over Wi-Fi, I have configured the ESP32 to connect to a Wi-Fi network, set up the ADXL335 accelerometer to read vibration data, wrote code to send the sensor data to a server using HTTP POST requests. But still getting the error
Error on sending POST: -1
This is my code
#include <WiFi.h>
#include <HTTPClient.h>
// Wi-Fi credentials
const char* ssid = "TurboNet";
const char* password = "your_PASSWORD";
// Server URL
const char* serverName = "http://your-server.com/post-data";
// ADXL335 pins
const int xPin = A0;
const int yPin = A1;
const int zPin = A2;
void setup() {
Β Β Β Β Serial.begin(115200);
Β Β Β Β // Connect to Wi-Fi
Β Β Β Β WiFi.begin(ssid, password);
Β Β Β Β while (WiFi.status() != WL_CONNECTED) {
Β Β Β Β Β Β Β Β delay(1000);
Β Β Β Β Β Β Β Β Serial.println("Connecting to WiFi...");
Β Β Β Β }
CONTRIBUTE TO THIS THREAD