Advertisement
Leo0777

Untitled

Jan 16th, 2023
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.91 KB | None | 0 0
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   Label1.Caption:= '';    //  ST
  4.   Label2.Caption:= '';
  5.   Label3.Caption:= '';    //  vaha
  6.   Label4.Caption:= '';    //
  7.   LazSerial1.WriteData(#$52#$0d#$0a);
  8.  
  9.   while (stavvazeni = 'ST') do
  10.    begin
  11.      Application.ProcessMessages;
  12.      sleep(100);
  13.      LazSerial1.WriteData(#$52#$0d#$0a);
  14.  end;
  15.  
  16.   sleep(500);
  17.   Memo1.Lines.AddText('stav vazeni ' + stavvazeni);
  18.   Label5.Caption:= stavvazeni;
  19.   Label6.Caption:= vaha;
  20. end;    
  21.  
  22. procedure TForm1.LazSerial1RxData(Sender: TObject);
  23. var
  24.     sl: TStringList;
  25. begin
  26. data := '';
  27. sleep(50);
  28. data := lazserial1.ReadData;
  29. sl := TStringList.Create;
  30. sl.Delimiter := ',';
  31. sl.DelimitedText := data;
  32. stavvazeni := Trim (sl[0]);
  33. vaha := Trim (sl[2]);
  34. Label1.Caption:= stavvazeni ;
  35. Label2.Caption:= Trim (sl[1]);
  36. Label3.Caption:= Trim (sl[2]);
  37. Label4.Caption:= Trim (sl[3]);
  38. sl.Free;
  39. end;            
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement