JAXPAROW
JAXPAROW

Reputation: 1

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

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

Upvotes: 0

Views: 1091

Answers (1)

Max Kleiner
Max Kleiner

Reputation: 1622

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

Upvotes: 0

Related Questions