Hi all
I have a problem where I am waiting for a command from a PC serial port. Once the command comes in I run through some if statements
The structure of the commands is all basically the same eg "cu50". The problem I have is It sees it matches two things both cu5 and cu50.
Any ideas would be much appreciated
while (Serial.available()) {
delay(1); //delay to allow buffer to fill
if (Serial.available() >0) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the string readString
if(readString=="?VS"){
Serial.println("Box C");
}
if(readString=="*IDN?"){
Serial.println("Box C Voltage hybrid burden box");
}
if(readString=="?SN"){
Serial.println("Box C IP003");
}
if(readString=="cu2.5"){
bdn = readString.substring(2,7);
Unity2_5();
Serial.println(bdn);
}
if(readString=="cu5"){
bdn = readString.substring(2,7);
Unity2_5();
Serial.println(bdn);
}
if(readString=="cu7.5"){
bdn = readString.substring(2,7);
Unity2_5();
Serial.println(bdn);
}
if(readString=="cu10"){
bdn = readString.substring(2,7);
Unity2_5();
Serial.println(bdn);
}
if(readString=="cu50"){
bdn = readString.substring(2,7);
Unity2_5();
Serial.println(bdn);
}
}
}
//bdn = "";
readString="";
Serial.flush();