If with data from serial

I would like to use data recieved on serial1 and if that data is ERROR,I would like my microcontroller to respond with "AT+CFUN=1,1.I tried cupple of codes that I wrote myself and none worked.

if(strcmp(data,"ERROR") == 0)
{
  // error received so send your AT command
}

The 'data' variable obviously needs to be a character array (or a pointer to that), not a String (with capital S).

void setup() { Serial1.begin(9600); }

void loop() { char data; if(strcmp(data,"ERROR") == 0){ Serial1.print("You recieved error") } }

It doesnt compile,it says "exit status 1 invalid conversion from 'char' to 'const char*' [-fpermissive]"

char data;How much of the string "ERROR" do you think you could store in the char variable "data"?

(sp. "Received")

Please use code tags as AWOL and I did to post code. If you quote one of our posts that contains code, you can see how it's done using [code] and [/code].

And as AWOL indicated and as I mentioned, you need a character array.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. And compatible with the advice in Reply #1

...R