Expected primary-expression before '}' token

this is the code used for the esp8266 12e to receive from UNO R3

#include <SoftwareSerial.h>

SoftwareSerial NodeMcu_SoftSerial (D5, D6); //RX, TX

//Declare Global Variable
char c;
String dataIn;

void setup() {
// put your setup code here, to run once:



void loop() {
// put main code here, to run repeatedly:

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

if (c == '\n')

//Reset the variable
c = 0;
dataIn = "";


and this is the error message

C:\Users\djw54\OneDrive\Documents\Arduino\01._esp8266_to_arduino_serial_07222021\01._esp8266_to_arduino_serial_07222021.ino: In function 'void loop()':
01._esp8266_to_arduino_serial_07222021:26:5: error: expected primary-expression before '}' token
26 | }
| ^
exit status 1
expected primary-expression before '}' token

Learning how to program using Python,


check this line.

Thank You

should have been:

else dataIn +=c;

i forgot to add the c;

thx again

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