Arduino serial data to delphi vrangular gauge in delphi 7 using comport

1k Views Asked by At

Am trying to read analog data from arduino mapped to 0-100 and send it through serial communication and use it to display its corresponding value in vrangularmeter in delphi7 but the vrangularmeter doesn't respond to my data, am using the comport for delphi serial communication Here is my arduino code snippet

Here is my delphi code

1

There are 1 best solutions below

0
On

Try to understand your snippet and set a solution:

  procedure ComPortRxChar(Sender: TObject; Count: Integer);
                                      var LReadedStr: String;
  begin
   // Read string from COM port
   ComPort.ReadStr(LReadedStr, Count);
    // If string is not empty
   if Trim(LReadedStr) <> '' then begin
    // Check for status and enable buttons
    if Trim(LReadedStr) = 'READY' then begin
     btnLedOn.Enabled := True;
     btnLedOff.Enabled := True;
    end;
    // Add string to memo
    memResponse.Lines.Add(LReadedStr);
    // Move memo vertical scroll bar to end
    memResponse.ScrollBy(0, 99999);
  end;
 end;

Example: https://sourceforge.net/projects/maxbox/files/Arduino/1052_delphi_arduino.txt/download