LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem sequencing certain boolean signals

 


tbob wrote

I'm not familiar with the action of your wimote.  Does the boolean go true, then false right away?  Every time it fluctuates, an event is fired (Value "Change").  This will prevent Signal from becoming true.  You need to describe what happens to these booleans and when you want signal to fire.  Like, bool 1 becomes true, then it goes false, then bool 2, etc...

 


 

Made the corrections, thanks.

 

The changing of the wiimote positions work like this (starting with position 1, then 2, then 3):

 

Boolean 1 is True, then as soon as Boolean 2 becomes True, 1 becomes False.

Then when Boolean 3 becomes True, 2 will be False (and 1 remains False).

 

See, what I did was I wrote down all the (accelerometer) values for certain positions.

 


 

Then I expanded the range so that there is no "gap" between any of the positions.

What I still would like to happen is to go from position 1, to 2 and then 3 (in that exact order) and then "trigger" something (in this case 'Signal'), but perhaps this is not possible since the Boolean values turn to False as soon as a new position is being held?

(I hope I explained it clear enough.)

0 Kudos
Message 11 of 22
(1,026 Views)

Try the attached vi.  Just take the code and substitute it into your code.  You can delete the local variables inside the Timeout case.  I was just simulating the booleans going false.  You have to hit the three booleans in the right order (1,2,3) to get the signal output.  If you go out of order, the flags are all reset and you have to start over again.  This should work fine.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 22
(1,017 Views)

That looks impressive!

I think I know what to adjust, but these (what I think are) boolean arrays can't simply be copy-pasted, right?

 

Boolean Array.GIF

 

I have to create them using my own indicators I reckon.

Cheers for all the help!

0 Kudos
Message 13 of 22
(999 Views)

That is a boolean array constant and you can create it, or copy and paste it.  Choose array constant from the array palette, then choose boolean constant from the boolean palette.  Then drag the boolean constant into the empty array constant.  Then you can drag the array border to expand it to 3 elements.  Then you have to assign either T or F to each element by clicking on it.  To make it small, I went a step further and hid the index display.  Right click on the array border and select Visible Items, then uncheck the Index Display.  So either create your own or just simply copy the one from my vi.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 14 of 22
(982 Views)

Well it works, almost.

I didn't get a result at first, so I tried placing some probes again and discovered that when holding the Wiimote steady in position 1, Probe no. 1 (on the snapshot below) remains True, but no. 2, 3 & 4 keep on blinking True/False. Because of this I can't get position 2 (and 3 after that) to work in sequence.

 

Probe 2.gif

Not sure why that was I tried putting the whole thing in a seperate while loop (just to be certain), but the results remained the same.

Then I thought that it might be because of the wireless (blue-tooth) connection of the wiimote.. but the New Value remains a constant True so that doesn't hold up either I suppose.

I feel kinda bad 'cause you handed me the code on a platter and I still can't get it to work. =S

 

0 Kudos
Message 15 of 22
(955 Views)

Why does 2, 3, and 4 blink True/False?  Shouldn't it stay false until you get to that position, then it turns true until you go away from that position?  If this is not the way it works, my code won't work properly.  You need to find out exactly how each boolean reacts, from start to finish.  If they blink, what happens when the correct position is achieved?  If indeed they do blink constantly, the coding will become extremely difficult.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 16 of 22
(951 Views)

 


@tbob wrote:

If indeed they do blink constantly, the coding will become extremely difficult.

 


 

Unfortunately I'm afraid this is the case.

I've done some testing and when the Wiimote is held in position 1, all three probes in the image below will continue to blink True/False.

 

01.GIF

 

However, if I time it right (and with that I mean perform the same "position 1 to position 2"-movement 40 times or so) the True signal will pass on and for a moment all the probes in the image below will remain True.

 

02.GIF

 

Now again, if I 'time' it right I can get to position 3 with all the probes below remaining True for a moment.

03.GIF

With the result that Signal will switch on:

04.GIF

So in essence it works.. but if it isn't 'timed' exactly right then Signal won't go off.

 

I don't have a clue why the probes continue to blink True/False in the first image. When I probe the 3 different boolean NewVal in the Event Structure they all remain a steady True when the Wiimote is being held in the correct position, unfortunately this doesn't result in a steady signal throughout the Event Structure.

0 Kudos
Message 17 of 22
(930 Views)

If the probes blink continuously, what distinguishes the Wimote being in the correct position?  It goes true?  Well it goes true when it is not in the correct position.  There has to be something unique about the correct position.  You need to find out what that is.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 18 of 22
(913 Views)

 


@tbob wrote:

If the probes blink continuously, what distinguishes the Wimote being in the correct position?  It goes true?  Well it goes true when it is not in the correct position.  There has to be something unique about the correct position.  You need to find out what that is.

 


 

Do you mean that I have to be sure that all three positions are unique? I've checked on that, but that seems to be the case. Also the probes only blink when I'm holding the wiimote in the first position, when I switch to position two and three they turn to false (unless I do it really fast with the result that 'Signal' gets activated).


I've taken a good long look at your code again though and perhaps I found the problem.

Again I've added some probes and this is what I get when pressing the first button.

 

Bool1.GIF

Turns out I get the exact same result when instead of using a while loop I use a for loop (with only 1 iteration).

But what happens when I press the first button again?

Bool2.GIF

 

We get the above result.. and if we were to press the first button ten times in a row we get the blinking probes just like I do.

 

So, I changed the code a little into this:

Bool3.GIF

Bool4.GIF

Bool5.GIF

 

This way the 'And Array Elements' will still get a true signal when the wiimote is held in the same position for several moments.

I've tested it and it seems to be working now, but is this okay what I did?

 

0 Kudos
Message 19 of 22
(886 Views)

There is nothing wrong with your changes.  If it works, then you did a good job.  Congratulations.

- tbob

Inventor of the WORM Global
0 Kudos
Message 20 of 22
(882 Views)