From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

4by4 puzzle type parking system

The "Assigning Car Numbers" section is poor C code; you could write it directly the same way in LabVIEW, but I wouldn't recommend it. Consider using arrays. I'd create a 1D array of 15 elements (for pA through pR), and then, as you loop through the board array, anytime that element of the board is between A and R set the corresponding element in the 1D array. To assign a letter to the first free space - which is what I think this function does - loop through the 1D array until there's a 0 value. The index at which it occurs is the value to assign (in C, you can add values to characters, so you could add the array index to 'A' to get the correct letter). In LabVIEW I'd use numbers or enumerations instead of characters.

 

Also, there's no reason to reset pA, pB etc to 0 at the end of the function.

 

The second function is trivial to implement in LabVIEW. Create an array constant containing a cluster of 2 elements (x and y). Run that array into a for loop, using auto-indexing to go through each array element in order until you find a spot where board contains '-'. Board will need to be stored in a shift register around the for loop.

0 Kudos
Message 41 of 41
(355 Views)