// This project discards the Serial output from the sketch;
// instead, it connects the serial monitor to a physical serial port on your computer.
//
// Only works on Chrome
String txt="";
String test1="";
String data="";
int datastart;
int Tab=9;
const char lf = 10;
const char tab = 9;
const char cr = 13;
void setup() {
Serial.begin(115200);
Serial.println("V,I,P,SOC");
}
void loop() {
if (Serial.available()) {
txt=Serial.readStringUntil(lf);
test1="V";
test1+=tab;
if (txt.startsWith(test1)){
data+=txt.substring(2)+",";
}
test1="I";
test1+=tab;
if (txt.startsWith(test1)){
data+=txt.substring(2)+",";
}
test1="P";
test1+=tab;
if (txt.startsWith(test1)){
data+=txt.substring(2)+",";
}
test1="SOC";
test1+=tab;
if (txt.startsWith(test1)){
data+=txt.substring(4);
}
test1="Checksum";
test1+=tab;
if (txt.startsWith(test1)){
Serial.println(data);
txt="";
data="";
}
}}