LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to increment PicRing by 1?

So I have a PicRing of about 30 pictures. And I have a button in which, when pressed, should increment the PicRing by 1. But, it doesn't work. Right now I created a value-property node from the PicRing. Then I attached a +1 increment symbol to it, and then attached that symbol to the Local Variable of the PicRing. But.... when I press the button, nothing happens. The PicRing should go to the next picture, but it doesn't. Absolutely nothing happens. I feel like there is a simple solution for this, but it's been evading me.

0 Kudos
Message 1 of 11
(3,624 Views)

Some code would really help figure out what youre doing wrong, but here is a simple example of doing this.

 

 Increment Pic.png



-Matt
0 Kudos
Message 2 of 11
(3,622 Views)

That sounds really convoluted. Simply keep the value in a shift register and use the +1 primitive.

Is your ring a control or indicator?

 

But yes, please show us some simplified code that show the problem. Tell us how you operate it, what you get, and what you expect to get instead. Thanks.

0 Kudos
Message 3 of 11
(3,614 Views)

@Wolleee wrote:

Some code would really help figure out what youre doing wrong, but here is a simple example of doing this.

... and if you would make the ring an indicator and wire it before the event structure, it will automatically reset on program start and you don't need any property node at all (In your code, a local variable would be more reasonable than a property node)

0 Kudos
Message 4 of 11
(3,610 Views)

Here's the code I've got, plus PicRing. And thanks for the example. It is somewhat the same, but you've got a few more details added. Is that a for loop inside the while loop?

0 Kudos
Message 5 of 11
(3,583 Views)

If you have labview 2015 you can actually just pull the snippet into a blank VI so you can look at the code.  There are two important functions in my example that you are missing. 

 

1st, i have a shift register, the nodes on the while loop that work as a variable for storing the value of the pic ring. 

2nd, i have an event structure inside the while, this is used to effeciently capture the button press.

 

Shift registers

 

Event Structures



-Matt
0 Kudos
Message 6 of 11
(3,574 Views)

@Wolleee wrote:

If you have labview 2015 you can actually just pull the snippet into a blank VI so you can look at the code. 

Shift registers

 

Event Structures


He does, VI Properties of the attched vi (General Page) show the source version as 15.0

I even have a Jing Demo of poofing code from a snippet


"Should be" isn't "Is" -Jay
Message 7 of 11
(3,570 Views)

@JÞB wrote:

@Wolleee wrote:

If you have labview 2015 you can actually just pull the snippet into a blank VI so you can look at the code. 

Shift registers

 

Event Structures


He does, VI Properties of the attched vi (General Page) show the source version as 15.0

I even have a Jing Demo of poofing code from a snippet


Jeff,

 

Thanks for that tip.  Ive probably picked up at least 3 or 4 useful tips from you this week alone. 

 

Shogun Orta,

 

You are also using an indicator for your pic ring, so based on the code you presented you dont actually need a property node.  You can wire the pic ring value directly to the indicator. 



-Matt
Message 8 of 11
(3,565 Views)

@Wolleee wrote:

Jeff,

 

Thanks for that tip.  Ive probably picked up at least 3 or 4 useful tips from you this week alone. 

 


I've been wondering If I gained a stalker. Smiley Very Happy nice posts by the way


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 11
(3,557 Views)

@ShogunOrta wrote:

Here's the code I've got, plus PicRing. 


Some quick comments:

  • Don't use continuous run, wrap the code in a while loop.
  • The button should be latch action, so it automatically resets to false after the code has read the new value. (right-click...mechanical action...latch when released").
  • There is no need for any property nodes.
  • If you show the digital display of the picture ring, you don't need an extra indicator. (right-click..visible items...digital display)
  • Use the correct representation to avoid all these coercion dots.
  • Wire to the terminal instead of local variables.
  • Add a wait to bring the loop rate to something reasonable and save energy.
  • You need to wrap back to zero once you run out of frames.

Here's a implementation without event structure to keep things simple and just to give you some ideas. I would recommend to go over some tutorials. (Yes, an event structure should be used once you are more familiar).

 

Download All
0 Kudos
Message 10 of 11
(3,541 Views)