Not sure how to ask this question, but I am trying to convert a Python program to freeBasic. In the Python serial comms, it has a ser.readline() command, which reads a line of incoming data up to a CR. Now I know that freeBasic does not have anything like that, has anybody created something like this.
For my project I have a device that uses a serial connection to stream data, a line at a time that is CR(\n) terminated. I am not even sure as to how I would approach doing this.
I have tried something like this, but it is not working as expected.
Code: Select all
While LOC(1) > 0
buffer = Input(LOC(1),#1)
If buffer = Chr(13) Then
Put #2, ,buffer
'End If
Wend
I am trying to capture one line of data, prefix with date and time, and then have it stored in a xxx.csv file. I tried just a regular read and store of the data, but I cannot attach a date and time to each line of data. I need some help with this one.
Thanks