LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing zeros and synchronising data inputs to a real time graph

Solved!
Go to solution

Hi,

 

I am trying to read data from an Arduino which is reading from 3 ultrasonic sensors. In the code i am trying to do, I am using trigonometry with only 2 sensors so that i can find the angle to do object detection. 

However, when reading the data from the serial port it is not being read at the same time therefore i cant just out put it into a graph as the reading need to be entered together.

Therefore i am trying to wait for the other input angle to come in from the serial port so they can both be put into a graph at the same time so a graphical image can be shown on labview. 

Another problem is that zeros keep being sent into the array, when an object is not in the intersection range of the two sensors a value isnt sent to the serial port, but even so I am struggling to control this. 

 

I have uploaded my code, any suggestions will be grateful.

I tried doing a formula node so that it outputs the values if A and B doesn't = zero but didn't go very well. 

 

Thanks for everything,

Alexz

 

 

 

0 Kudos
Message 1 of 3
(2,463 Views)
Solution
Accepted by RavensFan

One is always going to be equal to 0 because only one case of the case structure can execute in any given loop iteration.  So the other output will always be the default value of 0.

 

Why don't you combine the two angles together in one message as the arduino;   Left,Right  then break the two part after doing a single read in the LabVIEW VI?

Message 2 of 3
(2,455 Views)

Hi RavensFan,

Thanks for your help, I tried the angles coming in at the same time and it worked to some extent. What i did was went further and decided to output everything on one data line and do some string management. Was a bit annoying but i got it going, thanks a lot for your help. 

0 Kudos
Message 3 of 3
(2,431 Views)