serial.read if else

I'm not doing it right and i don't know how to correct it.
can someone help me please ?
What I'm trying to do here, is to send step for step bytes. and if the 3 bytes had been sent, in the end it should show me something.

read_with_pressure1.ino (3.38 KB)

byte byteRead;

byte state;

#include "Wire.h"
#include "Adafruit_BMP085.h"

Adafruit_BMP085 bmp;

void setup() {
// Turn the Serial Protocol ON
Serial.begin(9600);
bmp.begin();
Serial.println("Enter Your Order");
delay(1000);
}

void loop() {
/* check if data has been sent from the computer: /
if (Serial.available() > 0) {
/
read the most recent byte */
byteRead = Serial.read();
}
if (byteRead=='!'){
Serial.println("1");
state = 1;
}

else {
state = 0;
}

if (state==1){
if (byteRead=='N'){
Serial.println("2");
state = 2;
}
}
else {
state = 0;
}

if (state==2){
if (byteRead=='s'){
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");
}

else {
state = 0;
}
}
}

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

And please post your code between [code] [/code] tags so your code looks like thisand is easy to copy to a text editor

...R