Data to Website with Serial

Hi,
Im trying to build a website to show some data from my Arduino Mega. I am using a ESP8266 (F12 Mini) to build the website. The problem I have is sending two different numbers to my Website. I am using a Serial communication between the Mega and ESP which works at the moment. I have a problem sorting out the data recieved from Serial.

void loop() {


  while (testSerial.available() > 0) {
    char bt = testSerial.read();
    Serial.write(bt);
    Temp= String(bt);
  }

Here I am reading the data from Serial and using Temp as String for my Website.

What is the problem? Need more info.

Serial Input Basics - updated - Using Arduino / Introductory Tutorials - Arduino Forum

There are lots of things on this site about serial.

Are you using level shifters between the maga and the ESP? If not the ESP can be damaged.

Having recently built a thriving fishing website about reel reviews for professional anglers, Now Im trying to build the new website same as asked by @thechoosenone02 to show some data from my Arduino Mega by using ESP8266 (F12 Mini). I am also facing the same issue and my google searches led me here in this thread and same problem is with my website, looking for any more effective response to this thread for fixation of our same issue.

Thanks in advance!

give some examples of the data you wish to send to the website and what you want the website to look like
where is the data comming from?

Why bother with the Mega. Why not do all processing on the ESP? It's a much more capable processor.

I think this problem perpetuates because despite the numerous answers, the environment a novice coder is working in is several layers beyond their experience. It is cool to work inside of such and encapsulated environment until you have to work around that environment.

HTTP is how a website serves content to the world. This usually means a file system and directory in that file system with the HTML, CSS, Images and other media, and a web service such as Apache2 or similar handling the incoming HTTP requests and making the file system access to respond to the requests with the appropriate resource.

This is a stateless system, as the pages are static and never change. Except we can add PHP (hypertext pre-processing) to change the content of the HTML before responding...

Now, we are not talking about an Apache cloud-hosted virtual machine, but a ESP8266.

So, what is the operating system? What is the file system? What is the Web Service? How do we do hypertext preprocessing?

If you want to do everything inside the ESP8266, which is fully doable, those are the questions that need answers.

What is the operating system? I'd suggest using FreeRTOS.

What is the file system? well, we can have one, or we can handle incoming HTTP requests by directly parsing a response in code or using strings etc.

What is the Web Service? again we can handle incoming HTTP requests in various ways.

How do we add dynamic content? We change the way we handle incoming HTTP requests.

How I do it, is I use a file system and RTOS, and in my HTML files, I use comments where I want my dynamic content to be. As I am parsing the file, in my preprocessing, I replace the comment in my response with a response from either a function call or an atomic variable.

I don't understand how that has anything to do with the topic at hand. Nobody is talking about Apache, etc.

This seems similar to all ESP-based web server applications. Just serving up a very simple web page. No OS required, ESP82866 handles it just fine. And, BTW, ESP8266 does have a file system ... SPIFFS and/or LittleFS.

The only question here is why does the OP want to collect data on a Mega just to transfer it to the ESP for use in the Web Page the ESP is already hosting? Why not just collect the data using the ESP and avoid the transfer?

The ESP8266 is much more capable than that. I wouldn't expect it to handle heavy traffic, but it can certainly handle serving up a full-featured web page with several dynamic elements. I did not read the question as how to receive serial data as much as how to show dynamic content embedded into the html response. To be fair the question is still very unclear.

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