LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling variable input using Scan From String function

Solved!
Go to solution

I'm using NI (9229) to acquire data from analog sensor and stamped the location and time from GPS using arduino (as attached VI). My problem is with Scan From String function because, it only separate the output according to the defined following formate (Satellites in view: %d Lat/Long: %f %f Date/Time: %<%d/%m/%Y %H:%M:%S%2u>T). However, for any unpredictable input from GPS other than the defined format, it complains.

Kindly, how to solve this issue, or restrict the input to Scan From String function if and only if identical to defined formate.

Great Thanks

0 Kudos
Message 1 of 3
(822 Views)
Solution
Accepted by Emad_NRIAG

Hi Emad,

 


@Emad_NRIAG wrote:

However, for any unpredictable input from GPS other than the defined format, it complains.


Implement some error handling…

ScanFromString has an error output: you just need to use it!

 

Btw. also get rid of BytesAtPort, especially when your Arduino messages come with a TermChar!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(820 Views)

Great Thanks, @GerdW. Your suggestions solved my problem 🙂

0 Kudos
Message 3 of 3
(793 Views)