LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incrementing to a point, then decrement it back

Hello. 

 

I've been trying it for a while now and can't figure it out.

I have a value A from 0 to 5 and i increment it with 1 every 1 sec.(i used a shift register for that).

The problem is, when i reach 5, i have to increment with 1 another value B and value A should decrement back to 0 then B is incremented again and A goes back to 5.

 

I have a 3D array, and I need to read on the column 0 (value B) the entire row(value A). When A reaches the end, B should go to column 1 and A should go back from 5 to 0. Then of course when B reaces 5 another value C for the page should increment. but if i understand one of them, i will understand the second for sure.

 

I'm trying to some kind of simulation of a 3D Printer movement.

How can I achieve that? I have to convert the controls that are now manually into automatic ones.

Thank you very much.

Cristi

0 Kudos
Message 1 of 4
(2,442 Views)

For Loops will auto increment arrays.  You can nest them to increment through every element in a multi dimensional array.

 

I attached an example that processes your 3D array.  I set the loop time to 10ms, instead of the specified 1sec, just to speed up the execution.  I added the negate function, just to show that something was happening in the loop, you would replace it with whatever function is to be performed during your 1sec window.

0 Kudos
Message 2 of 4
(2,409 Views)

This is how I'd do it...

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

Thank you for your answers:) I managed to do it somehow, tho your answers look a lot easier:)

0 Kudos
Message 4 of 4
(2,366 Views)