LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why array output comes 2 slot contain previous count

Solved!
Go to solution

excuse , hello i am from indonesia 
my program using arduino, i collect the data to get standard deviation , so i think i use an array , but im confuse with last  2 slot that always contain last measurement or zero if it never measure before , ty before

Download All
0 Kudos
Message 1 of 5
(1,973 Views)
Solution
Accepted by topic author kucink

Time to bring this up again

 

DON'T USE BYTES AT PORT!

 

Do you know you got a complete message?  What is the format that your Arduino sends the data?

 

A proper communication protocol will send a complete message and end it with a termination character that tells the end of the message has been reached.  Your Serial Configure is already set up by default to expect a termination character of a line feed character.

 

If your message is incomplete, then when it parses the data, you'll get an error or nothing with will be interpreted as a zero.

Message 2 of 5
(1,954 Views)

thanks for replying
if i not use bytes at port , im trying not to use it then the program dont run ,

 

my arduino send string data then i parcing it to get 4 input data analog from potensio resistor 

 

mr ravens can you give me a program or refrence for my program , ty for the advice 

0 Kudos
Message 3 of 5
(1,884 Views)
Solution
Accepted by topic author kucink

@kucink wrote:

thanks for replying
if i not use bytes at port , im trying not to use it then the program dont run ,

 

my arduino send string data then i parcing it to get 4 input data analog from potensio resistor 

 

mr ravens can you give me a program or refrence for my program , ty for the advice 


What do you mean by "dont run"? If you're using the println function, your Serial writes will end with a LF character. (e.g. if your code is "Serial.println(mydatavalue)" )

When you use the Match Pattern node you're splitting the string at each letter and then just ignoring parts of the string (because for example, the output at the B node will be "1023.00C1023.00D1023.00"

Consider using something like Scan From String Function instead (or Match Regular Expression with subpatterns).

Here's an example that removes the Bytes at Port:

skrip_BD.png

Read a large number for the "VISA Read" to ensure the reason for a complete read is a complete line (not fixed number of characters).


GCentral
Message 4 of 5
(1,876 Views)

thank you so much 
the program running by changing visa flush io with visa set io and delete property node 

thanks i will read more and ask more 
thanks mr ravens

0 Kudos
Message 5 of 5
(1,864 Views)