Files
hpos-hardware/hemocube/hemocube_mock/hemocube_mock.ino

146 lines
4.7 KiB
Arduino
Raw Normal View History

2023-08-09 08:36:53 +05:30
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
2023-12-06 14:50:11 +05:30
// Serial.begin(9600);
2023-08-09 08:36:53 +05:30
}
void loop() {
// put your main code here, to run repeatedly:
2023-12-06 14:50:11 +05:30
// TEST: Buffer + Sample
2023-08-09 08:36:53 +05:30
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");
}
2023-09-23 10:07:49 +05:30
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") {
2023-08-09 08:36:53 +05:30
Serial.println("#Sample Started");
delay(2000);
Serial.println("#Sample Completed");
2023-09-23 10:07:49 +05:30
}
2023-08-09 08:36:53 +05:30
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);
2023-12-06 14:50:11 +05:30
// RESULT SN HCV1002 BUFFER_555_GREEN_INTENSITY BUFFER_427_BLUE_INTENSITY SAMPLE_555_GREEN_INTENSITY SAMPLE_427_BLUE_INTENSITY REND
2023-09-23 10:07:49 +05:30
// Serial.println("RESULT SN HCV1002 23729 24801.67 19190.67 6995.67 REND"); // normal
2023-12-06 14:50:11 +05:30
// 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
2023-08-09 08:36:53 +05:30
delay(15000);
}
2023-12-06 14:50:11 +05:30
// // TEST: Device diagonistics
2023-08-09 08:36:53 +05:30
// while (Serial.available() == 0) {} //wait for data available
2023-12-06 14:50:11 +05:30
// 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") {
2023-08-09 08:36:53 +05:30
// delay(3000);
2023-12-06 14:50:11 +05:30
// 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");
2023-08-09 08:36:53 +05:30
// delay(15000);
// }
}