LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Checking state of button

Solved!
Go to solution

I've been studying the code you posted for my vending machine and I have some doubts, I don't know if the forum is the proper place to make questions, if not, just dismiss them. 

 

It's not clear to me how to deal with the local variables and unbundling the clusters, for example, let's say i would like to display on a separate numeric control the amount of each product, how do I even unbundle it?

 

It's so unclear to me still, I understand what it's telling me on the probe, but not to its entire extent.  I've tried doing an array and then unbundling as you did on the loop. 

 

 

 

 

Download All
0 Kudos
Message 11 of 16
(1,082 Views)

I would just add another numeric to the cluster.

Message 12 of 16
(1,080 Views)

@Blancoys wrote:

I've been studying the code you posted for my vending machine and I have some doubts, I don't know if the forum is the proper place to make questions, if not, just dismiss them. 

 

It's not clear to me how to deal with the local variables and unbundling the clusters, for example, let's say i would like to display on a separate numeric control the amount of each product, how do I even unbundle it?

 

It's so unclear to me still, I understand what it's telling me on the probe, but not to its entire extent.  I've tried doing an array and then unbundling as you did on the loop. 

 

 

 

 


Please keep asking questions!!!  It's the best way to learn here.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 13 of 16
(1,069 Views)

Hello, it's me again .. I've been trying to make sense out of the code you designed, and I have a hard time getting some things.

 

1. What does "-1 case" stand for? I think it's false

 

I tried wiring the exact same way but it tells me they're of different type, however they're both the same type. 

 

Blancoys_0-1649683354392.png

 

2. I have wired also the same way the timer, but it shows me a red dot. I understand the red dot is it means it's a different data type, however, it's numeric. 

 

Blancoys_1-1649683461687.png

 

3. Why is on the approach using "In Place Element Structure"? My understanding is that it's better for performing and that the information used is stored in memory, however, why is it better than normal bundle/unbundle right now? 

 

4. Why is my shift register not working? According to my understand of what I'm reading is that it's the exact same type (both the source and resulting cluster are the type definition). 

Blancoys_2-1649683684874.png

I've attempted replacing it and wiring again .. 

 

Thank you for your time as always. 🌞

Download All
0 Kudos
Message 14 of 16
(1,048 Views)
  1. You need to set the tunnel to "last value", not "indexing" (right-click tunnel to change). With indexing you get an array with one value per iteration. You only want [i] when the loop stops. The loop will stop when it runs out of elements, so we don't know if there was a match in the last iteration. If there was no match, we want a -1 as "sentinel value" (i.e. a value that has special meaning) to indicate that none of the elements matched. (As I said, we probably don't really need it here because one element is guaranteed to change, but it is a good habit to make it universal and to match the "search array" behavior).
  2. The wait wants a U32, not a I32. Right-click the constant to change the representation. Easier is to just right-click the terminal on the wait and "create constant". This will give you the correct type directly.
  3. If we want to "unbundle...modify...bundle", the IPE just looks a little cleaner (easier to read, fewer wire bends needed, etc.). Most likely there is no performance difference once the compiler optimizes the code behind the scene.
  4. .You can open the context help (ctrl+h) and hover over the broken wire. It will tell you what the problem is.

I'll have a look at your code later....

0 Kudos
Message 15 of 16
(1,025 Views)

Many thanks! 🌞

 

I've fixed the mistakes I had with the suggestions you made. 

 

The last shift register wasn't working because I had in the type definition no array (I would put it into the array in the front panel), and then I would initialize with an array, so it was passing a cluster with no array. 

 

Thank you for your suggestions and your time. 

 

 

 

0 Kudos
Message 16 of 16
(989 Views)