Sending data from Arduino sensors to a Java application using ESP8266

Hello there!

I am attempting to create a weather monitor using an Arduino MEGA2560 board, which will collect data from sensors and then send the data to a Java application run on a Windows 10 PC using an ESP8266 WiFi module. However, I am not sure how to receive data from the ESP on my PC, much less how to incorporate it into a Java program. Does anyone know how to receive data on a PC from an ESP8266 and be able to use it in a Java application? A code for both Java and Arduino would be appreciated!

Here is my Arduino Code (I don´t know if it would work):

#include <SoftwareSerial.h>
#include <SerialESP8266wifi.h>

#define RX_PIN 0
#define TX_PIN 1
#define ESP8266_RESET_PIN 2
#define SSID "Arduino"
#define PASS "password"

SoftwareSerial ESP(RX_PIN, TX_PIN);
SerialESP8266wifi wifi(ESP, ESP, ESP8266_RESET_PIN, Serial);

void setup() {
  ESP.begin(115200);
  wifi.setTransportToTCP();
  wifi.endSendWithNewline(true);
  wifi.begin();
  wifi.startLocalAPAndServer(SSID, PASS, "5", "2121");
  delay(5000);
}

void loop() {
  if ((wifi.isLocalAPAndServerRunning() == true) && (wifi.isConnection() == true)) {
    wifi.send("5", "Hello World");
  }
}

Happyface4567:
However, I am not sure how to receive data from the ESP on my PC, much less how to incorporate it into a Java program.

That sounds like a question for a Forum that deals with PC Java programming.

If your ESP8266 acts as a web server then your PC program needs to act as a client. And if your ESP8266 acts as a client then your PC program needs to act as a web server.

...R

https://www.youtube.com/channel/UCjdNHsAG33tgfZKxWou--1A