LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Programming Question using LIFA

My question is more a labview code issue more than a lifa question. but anyway. ive uploaded a vi which i am trying  to read the state of one of the arduino digital pins. but with the way i am running my main while loop it will not execute unless an event happens. I thought that my default case would execute always but it seems like my main loop only executes when my event loop and message queue tell it to go. how can i make it so that my main loop runs continuoulsy and executes my default state. One solution I came up with is in a disable structure at the bottom with a small while loop. but it seems that when the value is changed the property node does not trigger my event message queue either solution would be fine, but I would prefer to not have an extra parrallel loop. Thanks.

0 Kudos
Message 1 of 4
(3,390 Views)

Hey,

I think you have the right idea already with the Timeout case for the event structure - I think you will want to set the timeout to 1ms (or larger) instead of 0 though. This will make it so that if no other event is triggered then every 1 ms you execute that case instead.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 4
(2,690 Views)

Okay awesome  that seemed to work I have to work out somemore logic with that whole thing but at least now it is functioning properly. I had another question which LV help and google haven't been to helpful with. In the Arduino you can use the map value funciton to map one value to another range. Is there a function in Labview that can do that. I guess it would be pretty easy to make one, but why reinvent the wheel. Thanks

0 Kudos
Message 3 of 4
(2,690 Views)

I would probably just do the math to scale it - there might be some functionality burried in one of the math pallettes that could do this but I think its easier just to make a sub VI which will do a linear scaling (should just be y=mX+b)

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 4 of 4
(2,690 Views)