parse data

Hello Community,

I use serial communication (software serial) b/w arduino and nodemcu I get a bunch of data, like temperature, humidity , soil moisture and lux, how do i parse down each thing?

it sends data example ( 64, 31) in serial window, were 64 is humidity and 31 is temperature

Thank you.

my sample code of ardunio uno sending temperature and humidity to nodemcu.

#include <SoftwareSerial.h>
#include <dht.h>

#define dht_apin 7
dht DHT;

SoftwareSerial ArduinoSerial(3, 2);  // RX | TX

void setup() {
  // put your setup code here, to run once:
  pinMode(3, INPUT);
  pinMode(2, OUTPUT);
  Serial.begin(115200);
  ArduinoSerial.begin(4800);
  delay(500);//Delay to let system boot
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);//Wait before accessing Sensor

}

void loop() {
    // put your main code here, to run repeatedly:
    //delay(2000);   //sensor boot-up delay
    //Read data and store it to variables hum and temp
    DHT.read11(dht_apin);
    ArduinoSerial.print("Current humidity = ");
    ArduinoSerial.print(DHT.humidity);
    ArduinoSerial.print("%  ");
    ArduinoSerial.print("temperature = ");
    ArduinoSerial.print(DHT.temperature); 
    ArduinoSerial.println("C  ");
    //ArduinoSerial.print(100);
    ArduinoSerial.print("\n");
    //delay(100);
}

Have a look at the serial input basics thread

Serial Input Basics - simple reliable ways to receive data.

There is also a parse example to illustrate how to extract numbers from the received text.

...R