Serial communication between esp32 and arduino mega

hello, does somebody know how i can transfer data from arduino weight sensor to esp32 and the esp32 must store the data in firebase?
How can I fix this problem with code?

Have you solved the issue that the ESP32 is NOT 5V tolerant?

What problem with the code do you have? Post you problematic code in code tags, point out what the code is expected to do and what the code does.

Have you solved the issue that the ESP32 is NOT 5V tolerant?

Why did you post in the Dutch section of the forum but use the English language? I've moved your topic.

Thinking a bit out of the box, do you really need the Arduino Mega? can't you run everything from the ESP32?

Why would you be using an Arduino Mega 2560 if you have an ESP32? :thinking:

please edit your post, select the code part and press the </> icon in the tool bar to mark it as code. It's barely readable as it stands. (also make sure you indented the code in the IDE before copying, that's done by pressing ctrlT on a PC or cmdT on a Mac)

#include <FirebaseESP32.h>
#include <WiFi.h>
#include <DFRobot_HX711.h>

#define FIREBASE_HOST ""
#define WIFI_SSID "" // Change the name of your WIFI
#define WIFI_PASSWORD "" // Change the password of your WIFI
#define FIREBASE_Authorization_key ""

DFRobot_HX711 MyScale(16,4);

FirebaseData firebaseData;
FirebaseJson json;

void setup() {

Serial.begin(9600);
WiFi.begin (WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting...");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
Serial.println();
Firebase.begin(FIREBASE_HOST,FIREBASE_Authorization_key);

}

void loop() {
Serial.print(MyScale.readWeight(), 1);
Serial.println(" g");
delay(200);

Firebase.setFloat(firebaseData, "/ESP32_APP/Weight",MyScale.readWeight(),1);

delay(200);
}

This is my code. The problem is that the arduino mega can read the data from the weight sensor if i Use only esp32 I get only ????... as output

It seems that the DFRobot_HX711 library has not been tested on an ESP32

may be read this : ESP32 with Load Cell and HX711 Amplifier (Digital Scale) | Random Nerd Tutorials

image
if I use that code I get this

do you set the Serial monitor to the right value ?
do you adjust the voltage (if 5V communication is needed with your module)?

but i need the code for dfrobot hx711 he wrote it for hx711 library

how hard could it be to write the code for another library... ?

i am new to arduino

What is the serial monitor set to?

does somebody know/ have a code to measure weight with esp32?

Do you have a sensor that can be used to measure weight ?

looks like there is a arduino libraray for the DFRobot_HX711

consider the mechanics, e.g.
1 what weight are you looking at?
2 what size object?
3 would you need a load cell on each corner?

think we need more details of the application

I have merged your cross-posts @lilrobsky.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please take some time to pick the forum category that best suits the subject of your question and then only post once to that forum category. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.