Help with RS-232 message from scale

I ended up using the script suggested by @tjcrusher back in Feb 2025 and then put in an extra check to discard the occaionally short (garbled) RS232 message from the scale.

// Check if the message contains the ‘N’ character before processing
PosIdx = FindCharacterInString(78, 0, RS232_Receive_Message);

// Only process if ‘N’ was found (PosIdx will be -1 if not found)
if (PosIdx >= 0) then
  Incrementvariable(PosIdx);
  GetSubstring(RS232_Receive_Message, PosIdx, 6, Six_Digit_String_of_Weight);
  scale_weight = StringToFloat(Six_Digit_String_of_Weight);
endif

I then incorporated the suggestions from @philip to eliminate of the 0.3 sec delay (cannot remember why I had that there in the first place).

Much simpler now and very robust handling of the stream of data.

Recording 2026-01-11 160904

1 Like