I have done everything i found but just nothing works, or maybe i just dont understand why it wont work. Im only trying to pass data(String) from Arduino to Esp through serial comms. Please I need your help, I'm as dead as my deadlines.

Note: What I am trying to do is send data from arduino to esp and make esp send the data on a raspberry pi server through sockets. The rasp part is fine, i just need the data passed from arduino to esp.

Original Arduino code

volatile int flow_frequency; // Measures flow sensor pulses
unsigned int l_hour; // Calculated litres/hour
unsigned char flowsensor = 2; // Sensor Input
unsigned long currentTime;
unsigned long cloopTime;
void flow () // Interrupt function
void setup()
   pinMode(flowsensor, INPUT);
   digitalWrite(flowsensor, HIGH); // Optional Internal Pull-Up
   attachInterrupt(0, flow, RISING); // Setup Interrupt
   sei(); // Enable interrupts
   currentTime = millis();
   cloopTime = currentTime;
void loop ()
   currentTime = millis();
   // Every second, calculate and print litres/hour
   if(currentTime >= (cloopTime + 1000))
      cloopTime = currentTime; // Updates cloopTime
      // Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min.
      l_hour = (flow_frequency * 60 / 7.5); // (Pulse frequency x 60 min) / 7.5Q = flowrate in L/hour
      flow_frequency = 0; // Reset Counter
      Serial.print(l_hour, DEC); // Print litres/hour
      Serial.println(" L/hour");


#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>

SoftwareSerial  ESPlease(3,1);

const char* ssid  = "sendhelp";
const char* password =  "ple4seH3lpm3";

uint16_t port = 8090;
const char* host = "";

void setup()


  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {

  Serial.print("WiFi connected with IP: ");


void loop()
    WiFiClient client;

    if (!client.connect(host, port)) {

        Serial.println("Connection to host failed");

    String message = "";

    Serial.println("Connected to server successful!");
    while(Serial.available()) {
      message = Serial.readString();
     // messageReady = true;
    String sensorValue = message;
    String sname = "flowRate-";
    String stringThree = sname + sensorValue;

    if(sensorValue != 0){



please help me anyone :(

  • SoftwareSerial on hardware Serial pins? pin mode of RX/TX changed after Serial.begin()? where do you output data in Uno? I see only a simple print to Serial – Juraj Nov 2 '19 at 4:33
  • that's it, i dont know where i output code anymore. some say all i had to do was print it to serial. I know the code is full of useless stuff its because I have tried so many times already – Joseph Joe Nov 3 '19 at 5:09
  • but the useless code is in the way. clean it up – Juraj Nov 3 '19 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.