Reputation: 1
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
Upvotes: 0
Views: 1091
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