LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

school project help

Solved!
Go to solution

hi guys 🙂

 

i am participating in the hit-chalenge, and i got a few questions, it is my first time using labview, had 2 quick-classes in it. so please be easy on me 😉

 

i have included my file in this post.

 

we are working with a arduino to identify 2 playmobil-dolls with RFID, all is good there i can let the leds burn for who's who.

but then the real problem. i need to play music A (a wav file, all of the musics are) when doll A walks in the room (through a RFID tag reader) and play music B when doll B walks in. nothing too hard there, or so it seems. the hard part is to let music C play, when they're both in the room.

but the hardest part is to let the music stop when one of them walks out again. or if they were both in the room, to let the music play that is destined for the doll that remains in the room.

 

please help me out here.

a very importent exam grade is binded to this challenge.

 

file:

http://dl.dropbox.com/u/15212753/pws/readrfid%20pws.vi

0 Kudos
Message 1 of 34
(3,175 Views)
Solution
Accepted by topic author legodude

Your problem is a matter of logic..  😉

 

I would use a state machine which is triggered by enter / leave events (among others, such as play tune, etc).

An easy way to keep track of who's in the room is to have an array of booleans.  You assign a bit for a given doll.

Example :

 

no dolls in room: b0000

doll C enters room: b0010

doll A enters room: b1010

doll D enters room: b1011

doll C exits room: b1001

 

and so on

 

In the play wave state, you would have a Case Structure that select the appropriate wav file for the given situation.

For instance, you could convert the boolean aray to numeric (number) and have that number index the Case.

You would only need one play wave vi which is fed the filename from the Case Structure.

 

That should get you going..

 

 

EDIT:  I did not look at your VI.

Message 2 of 34
(3,165 Views)

Ray beat me to my suggestion. I would use the RFID to toggle a bit for each "participant" and use a boolean array to binary conversion VI that operates a case selection. I did this recently to determine how to select the next state of a state machine based on certain events, such as errors, button-pressing events, and the expiration of a time counter. I learned how to do this from searching the forums and the help files, as well as lurking on many threads on the forum. I found that the "experts" on the forum are extremely helpful when a poster asks direct questions, as you have done (selection of music to play based on which dolls were present).

 

I did glance at your code, and it appears that there are redundant WHILE loops to process event changes and the like. I am a relatively newbie, but it appears to me that a producer-consumer architecture would be the way to go for you, with a state machine in your consumer. A producer would identify which robot is present and send a state change command (via notifier) and the new state (via queue) to the consumer state machine. The consumer enters the state appropriate for the participants who are present, in which the appropriate music in played. I suspect that you may also have other actions or interactions of the characters that may be state-specific that you can them implement in each state.

 

While building several applications, I initiated two threads where forum members helped me learn the P-C architecture. See:

http://forums.ni.com/t5/LabVIEW/How-To-Exit-While-Loop-with-Timing-Delay/m-p/2151844

http://forums.ni.com/t5/LabVIEW/How-to-efficiently-collect-data-in-while-loop/m-p/2178370#M700074

 

Jeff Zola

Jeffrey Zola
Message 3 of 34
(3,155 Views)

Well done Jeff 🙂

Message 4 of 34
(3,152 Views)

first of all thank you very much for your help 😄

 

but im not that advanced in labview, so i don't know how to save the states, the rfid results in a pulse, wich i have managed to save via some quirky behaviors (used in the VI in the main post too) does anyone know of a better way to save a on/off state? and have it accessible for later use?

0 Kudos
Message 5 of 34
(3,122 Views)

Do you mean that the dolls can be on or off?

 

Saving sates should be easy, there are various ways to save (write) to file and various ways of reading them.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

 

Message 6 of 34
(3,109 Views)

@Ray.R wrote:

Do you mean that the dolls can be on or off?

 

Saving sates should be easy, there are various ways to save (write) to file and various ways of reading them.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

 


For example, a pulse from the entrance/exit of a doll creates a queue element that toggles a bit in a state indicator. A notifier may be necessary to tell the state machine portion to transition to its next required state.

 

Jeff

Jeffrey Zola
Message 7 of 34
(3,079 Views)

i think that's what ive done too. but it is a little buggy. because it needs a delay.

did you look at my vi?

0 Kudos
Message 8 of 34
(3,052 Views)

not yet. 


You can attach it to your post.  Below the editing window, you can browse and attach your vi.

Message 9 of 34
(3,022 Views)

Thank you all so very much for your help,

i managed to do it using a array, config files and using a windows media player activex element.

 

i'll let you know the results of the challenge 😉

 

Thanks guys 😄 

0 Kudos
Message 10 of 34
(2,989 Views)