May be using TBlockSerial from unit synaser from Ararat Synapse ?
( doc: http://synapse.ararat.cz/doc/help/synaser.TBlockSerial.html , download: http://synapse.ararat.cz/doku.php/download ).

Given a variable (SynSer: TBlockSerial;), you can test if data is available with SynSer.CanReadEx(0) and then use SynSer.RecvPacket(Timeout) to get your data.

I think it should work, I haven't used directly TBlockSerial this way, but through TLazSerial component for reading data from an Arduino in a program running on Windows, Linux x86, or Raspberry.

I think TBlockSerial can work in your console program  context. May be TLazSerial can be more tricky to use in your context, you'll need to use events/callbacks and FCL.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to