void setup() { // put your setup code here, to run once: Serial.begin(115200); // Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: // TEST: Buffer + Sample while (Serial.available() == 0) {} //wait for data available String bufferCommand = Serial.readString(); //read until timeout bufferCommand.trim(); // remove any \r \n whitespace at the end of the String if (bufferCommand == "B") { Serial.println("#Start Buffer"); delay(2000); Serial.println("#Buffer Completed"); } while (Serial.available() == 0) {} //wait for data available String SampleCommand = Serial.readString(); //read until timeout SampleCommand.trim(); // remove any \r \n whitespace at the end of the String if (SampleCommand == "S") { Serial.println("#Sample Started"); delay(2000); Serial.println("#Sample Completed"); } while (Serial.available() == 0) {} //wait for data available String resultCommand = Serial.readString(); //read until timeout resultCommand.trim(); // remove any \r \n whitespace at the end of the String if (resultCommand == "P") { delay(3000); // RESULT SN HCV1002 BUFFER_555_GREEN_INTENSITY BUFFER_427_BLUE_INTENSITY SAMPLE_555_GREEN_INTENSITY SAMPLE_427_BLUE_INTENSITY REND // Serial.println("RESULT SN HCV1002 23729 24801.67 19190.67 6995.67 REND"); // normal // Serial.println("RESULT SN HCV1002 24900.67 26578.33 19760.00 9071.67 REND"); // NBL Serial.println("RESULT SN HCV1002 17974.33 9247.67 19952 12217 REND"); // negative abs delay(15000); } // // TEST: Device diagonistics // while (Serial.available() == 0) {} //wait for data available // String infoCommand = Serial.readString(); //read until timeout // infoCommand.trim(); // remove any \r \n whitespace at the end of the String // if (infoCommand == "I") { // Serial.println("SN HCV2002"); // } // while (Serial.available() == 0) {} //wait for data available // String diagnosticsCommand = Serial.readString(); //read until timeout // diagnosticsCommand.trim(); // remove any \r \n whitespace at the end of the String // if (diagnosticsCommand == "D") { // Serial.println("PG 7016"); // delay(500); // Serial.println("PG 10668"); // delay(500); // Serial.println("PG 14294"); // delay(500); // Serial.println("PG 17875"); // delay(500); // Serial.println("PG 21470"); // delay(500); // Serial.println("PB 17"); // delay(500); // Serial.println("PB 3225"); // delay(500); // Serial.println("PB 6776"); // delay(500); // Serial.println("PB 10429"); // delay(500); // Serial.println("END"); // } // // two path length device // // TEST: Device Info + Buffer + Sample // while (Serial.available() == 0) {} // String infoCommand = Serial.readString(); // infoCommand.trim(); // if (infoCommand == "I") { // Serial.println("SN HCV-000-3001"); // } // while (Serial.available() == 0) {} // String bufferCommand = Serial.readString(); // bufferCommand.trim(); // if (bufferCommand == "B") { // Serial.println("#BS"); // delay(2000); // Serial.println("#BC"); // } // while (Serial.available() == 0) {} // String SampleCommand = Serial.readString(); // SampleCommand.trim(); // if (SampleCommand == "S") { // Serial.println("#SS"); // delay(2000); // Serial.println("#SC"); // } // while (Serial.available() == 0) {} // String resultCommand = Serial.readString(); // resultCommand.trim(); // if (resultCommand == "P") { // delay(3000); // Serial.println("RESULT"); // // // deoxy error // // Serial.println("LB1 25215"); // // Serial.println("LB2 25599"); // // Serial.println("LB3 24856"); // // Serial.println("LB4 25584"); // // Serial.println("LS1 560"); // // Serial.println("LS2 71"); // // Serial.println("LS3 3447"); // // Serial.println("LS4 4092"); // // // // SCT, no error // Serial.println("LB1 23777"); // Serial.println("LB2 24130"); // Serial.println("LB3 23442"); // Serial.println("LB4 23945"); // Serial.println("LS1 2521"); // Serial.println("LS2 973"); // Serial.println("LS3 10252"); // Serial.println("LS4 11017"); // // buffer high error // // Serial.println("LB1 21616"); // // Serial.println("LB2 21002"); // // Serial.println("LB3 24402"); // // Serial.println("LB4 24076"); // // Serial.println("LS1 507"); // // Serial.println("LS2 720"); // // Serial.println("LS3 2293"); // // Serial.println("LS4 6601"); // Serial.println("REND"); // delay(15000); // } }