I need to transfer my ECG data from one esp device to another esp device?

i tried creating data buckets to store and tranfer data to my 2nd esp but the bucket is not getting created. I am getting error 400

Code for ESP1:
#include <ThingerESP8266.h>
#include <ESP8266WiFi.h>

#define USERNAME “Tanishq_123456”
#define DEVICE_ID “esp8266”
#define DEVICE_CREDENTIAL “electronic”

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

const char* ssid = “JioFiber-4”; //–> Your wifi name or SSID.
const char* password = “Tithi@6884”;

const int ecgPin = A0; // Analog input pin for ECG signal

int ecgValue;

void setup() {
Serial.begin(115200);
pinMode(ecgPin, INPUT);
WiFi.begin(ssid, password);
thing.add_wifi(ssid, password);
thing[“ecg11”] >> (pson& out){
out[“ecgval”] = ecgValue;
};

}

void loop() {
thing.handle();
ecgValue = analogRead(ecgPin);
Serial.println(ecgValue);
delay(1000); // Adjust delay as necessary
}

Code for ESP2:
#include <ThingerESP8266.h>
#include <ESP8266WiFi.h>

#define USERNAME “Tanishq_123456”
#define DEVICE_ID “esp8266_2”
#define DEVICE_CREDENTIAL “electronic”

const int ecgLed1Pin = D1; // Red LED 1
const int ecgLed2Pin = D2; // Red LED 2
const int ecgLed3Pin = D3; // Red LED 3
const int ecgLed4Pin = D4; // Green LED 1
const int ecgLed5Pin = D5; // Green LED 2

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

const char* ssid = “JioFiber-4”; //–> Your wifi name or SSID.
const char* password = “Tithi@6884”;

void setup() {
Serial.begin(115200);

pinMode(ecgLed1Pin, OUTPUT);
pinMode(ecgLed2Pin, OUTPUT);
pinMode(ecgLed3Pin, OUTPUT);
pinMode(ecgLed4Pin, OUTPUT);
pinMode(ecgLed5Pin, OUTPUT);

WiFi.begin(ssid, password);  
thing.add_wifi(ssid, password);

// Define resource to receive ECG data
thing["myecg"] >> [](pson& in) {
    int ecgValue = in;
    Serial.println(ecgValue);
    controlLEDs(ecgValue);
};

}

void loop() {
thing.handle(); // Handle Thinger.io communication
delay(100); // Adjust delay as necessary
}

void controlLEDs(int ecgValue) {
// Map ECG data range to LED control
if (ecgValue < 200) {
digitalWrite(ecgLed1Pin, HIGH);
digitalWrite(ecgLed2Pin, LOW);
digitalWrite(ecgLed3Pin, LOW);
digitalWrite(ecgLed4Pin, LOW);
digitalWrite(ecgLed5Pin, LOW);
} else if (ecgValue >= 200 && ecgValue < 400) {
digitalWrite(ecgLed1Pin, LOW);
digitalWrite(ecgLed2Pin, HIGH);
digitalWrite(ecgLed3Pin, LOW);
digitalWrite(ecgLed4Pin, LOW);
digitalWrite(ecgLed5Pin, LOW);
} else if (ecgValue >= 400 && ecgValue < 600) {
digitalWrite(ecgLed1Pin, LOW);
digitalWrite(ecgLed2Pin, LOW);
digitalWrite(ecgLed3Pin, HIGH);
digitalWrite(ecgLed4Pin, LOW);
digitalWrite(ecgLed5Pin, LOW);
} else if (ecgValue >= 600 && ecgValue < 800) {
digitalWrite(ecgLed1Pin, LOW);
digitalWrite(ecgLed2Pin, LOW);
digitalWrite(ecgLed3Pin, LOW);
digitalWrite(ecgLed4Pin, HIGH);
digitalWrite(ecgLed5Pin, LOW);
} else {
digitalWrite(ecgLed1Pin, LOW);
digitalWrite(ecgLed2Pin, LOW);
digitalWrite(ecgLed3Pin, LOW);
digitalWrite(ecgLed4Pin, LOW);
digitalWrite(ecgLed5Pin, HIGH);
}
}

I am new to this IoT platform thing please bare me…

Hi,

I guess what you want to do is to send a value from device A to device B, so I recommend you to check the documentation there is an example about communication between devices.

Hope this helps

Welcome to the thinger.io community !

You are speaking of ECG data does the stay for Electro Cardio Gram?
In that case you need fast analog data to be exchanged between the two devices.
You mentioned however only digital values??

Are both devices logged to the same Wi-Fi network?
In that case a direct UDP connection might be faster, easier and take less resources.

If it is the case, I can give you the code.