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.
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");
}