I keep getting this break statement not within loop or switch error

I'm trying to make a serial communication between Arduino Uno and NodeMcu. This code is for the NodeMcu, I've been following tutorial but I seem to be stuck with break statement not within loop or switch error

#include <SoftwareSerial.h>

SoftwareSerial NodeMcu_SoftSerial (D1,D2);

char c;
String dataIn;

void setup() {
  Serial.begin(57600);
  NodeMcu_SoftSerial.begin(9600);
}

void loop() {

  while(NodeMcu_SoftSerial.available()>0);
    {
      c = NodeMcu_SoftSerial.read();
      if(c=='\n') {break;}
      else {dataIn+=c;}
    }

  if(c=='\n')
    {
      Serial.println(dataIn);

      c=0;
      dataIn="";
    }
}

You have a semicolon after the close paren; it shouldn't be there if you're expecting the part in braces to be the "while loop."

Oh so that's the problem, its working now. Thank you very much

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