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

47 lines
1.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);
}
void loop() {
// put your main code here, to run repeatedly:
2023-09-23 10:07:49 +05:30
Serial.println("SN:HCV1002");
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-09-23 10:07:49 +05:30
// Serial.println("RESULT SN HCV1002 23729 24801.67 19190.67 6995.67 REND"); // normal
Serial.println("RESULT SN HCV1002 1937.23 2828.11 19580.67 11060.67 REND");
2023-08-09 08:36:53 +05:30
delay(15000);
}
// 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 == "B") {
// delay(3000);
// Serial.println("ERROR 500 REND");
// delay(15000);
// }
}