Showing results for 
Search instead for 
Did you mean: 

Updating inside loop

Go to solution

Im currently making a program that is supposed to have 6 leds and these leds are supposed to light up respectively to a flipping a dice. But when it lands on six all leds are supposed to light up and blink twice. right now it only blinks once and its supposedly because im not updating inside the loop.

Heres all the needed images.

labview 4.PNG

labbview 2.PNGlabbview 3.PNG

0 Kudos
Message 1 of 13

Hi coolswe,


a program that is supposed to have 6 leds and these leds are supposed to light up respectively to a flipping a dice. But when it lands on six all leds are supposed to light up and blink twice.

Make it a state machine: use states like "roll dice", "display result", "wait" and "blink"…

And put a loop around your whole content of that 1st image!


Heres all the needed images.

We don't need images - we need VIs!

Best regards,

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 13

Adding on to the "needed images" conversation...


You've shown us the various states of that entirely awkward architecture you've put together.  But, what's the trailing double doing?  Is it relevant? Is it not?  Is it even important?


In LabVIEW, there are NEVER "needed images" unless you're posting a snippet.  That's like taking a "needed screenshot" of c code.  Would you ever consider doing that?  Of course not.  It'd be useless to post that as anyone that wanted to help would have to recreate the c code just to debug or offer any real advice.  Why would you do it with LabVIEW code?


In general, the posts you've received here are correct.  What you're doing now just doesn't make sense.  You've got a lot going on and it doesn't really work well together.  Updating "inside the loop" isn't your issue.  It's the loop altogether.  It's setup to run twice.  You could just as easily fix your issue by checking the value and stopping the loop based on that instead of always two times.  If you're always going to be running twice, why aren't you using a For Loop anyway? 


The state machine likely makes more sense.  You can handle your logic to roll the dice in one state.  From there, transition to the blinking as required.  Without knowing what else is going on in those "needed pictures," it's hard to offer you any worthwhile advice on how to fix things as we don't know how our suggested fixes will impact the rest.

Message 3 of 13
Accepted by topic author coolswe
Message 4 of 13

Im new to this so i dont know, im more of a text based programmer, and this is a forced course. Here is the vi file. 



0 Kudos
Message 5 of 13

This would be plagiarism?

0 Kudos
Message 6 of 13

It would be.  It's also why we don't typically post code like that.  It doesn't really help you in any way.


You're a text-based programmer.  That's honestly a good start.  Let's take a step back and ignore the LV aspect.  You've been assigned a program.  Isn't getting the algorithm in place the first step in text-based?  Let's do the same here.


Write the psuedocode in just quick blurbs about what you want to do.


Once you have that, we can place it into meaningful code (in any language).  The hardest part about acclimating to LV coming from text-based experience isn't that LV is graphical.  It's not data flow.  It's understanding that it's essentially the same thing.  It's a programming language.  When you move from C to Java, you've got to learn different syntax.  But, the ideas are all the same.  We want to use those same ideas and practices you've been using here.


Once you've done that, we'll replace variables with wires and function calls with data flow.  It's a slightly different "syntax," but you'll catch on to it pretty quickly.

Message 7 of 13

Thing is.... i dont want to learn... i want to be done with it

0 Kudos
Message 8 of 13

Then you're in the wrong profession.  You'll constantly be learning with text-based programming, computer science, or engineering.


If you're already unable to handle this, you're going to be a very miserable adult.  Find something more geared towards your aptitudes.

0 Kudos
Message 9 of 13

Im speaking of labview. Not interested

0 Kudos
Message 10 of 13