void setup() {
Serial.begin(115200);
}
void loop() {
float Fact = 123.234;
float Tara = 2.233;
float Tovar = (Fact - Tara);
char str[34] = "";
strcat(str, "\x06kg0\x0DG0000000\x0DT1111111\x0DL0000000\x0D\x0A\0");
char V_G[7] = "";
dtostrf(Tovar, 7, 3, V_G);
strncpy(str + 6, V_G, 7);
dtostrf(Tara, 7, 3, V_G);
strncpy(str + 15, V_G, 7);
dtostrf(Fact, 7, 3, V_G);
strncpy(str + 24, V_G, 7);
for (byte i = 0; i < 34; i++) {
if (str[i] == 0x0A) {
break;
}
if (str[i] == 0x20) {
str[i] = 0x30;
}
}
str[3]=0x31;
Serial.println(str);
delay(1000);
}