I'm new to embedded systems. I'm trying to send data/values to a NodeMCU and I found I could using the ArduinoJSON lib. I'm trying the same thing that the tutorial gives, but I don't know why it doesn't work for me. Can someone tell me why? And how to fix it?
This is the Arduino Nano script:
#include <SoftwareSerial.h>
#include <ArduinoJson.h>
SoftwareSerial s(5,6);
void setup() {
  s.begin(9600);
}
void loop() {
  StaticJsonBuffer<1000> jsonBuffer;
  JsonObject& root = jsonBuffer.createObject();
  root["data1"] = 100;
  root["data2"] = 200;
  if(s.available()>0){
    root.printTo(s);
  }
}
And this is the NodeMCU script:
#include <SoftwareSerial.h>
SoftwareSerial s(D6,D5); //RX,TX
#include <ArduinoJson.h>
void setup() {
  Serial.begin(9600);
  s.begin(9600);
  while(!Serial)continue;
}
void loop() {
  StaticJsonBuffer<1000> jsonBuffer;
  JsonObject& root = jsonBuffer.parseObject(s);
  if(root == JsonObject::invalid())
  return;
  Serial.println("Json received and parsed");
  root.prettyPrintTo(Serial);
  Serial.print("Data 1 ");
  Serial.println("");
  int data1=root["data1"];
  Serial.println(data1);
  Serial.print("Data 2 ");
  int data2=root["data2"];
  Serial.print(data2);
  Serial.println("");
  Serial.println("---------------------xxxxx---------------------");
}
When I check serial, it doesn't show the data that's sent by the Nano, but this thing shows up on the serial monitor.
⸮$r$rlp⸮n⸮⸮8⸮⸮⸮
By the way sorry for my bad English.
 
    