Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Passing A Variable To Soundboard V4

Assistance Requested

Help CochranRobotics with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

CochranRobotics claims to have checked these sources:
 
#1

I would like to do something like the following but can't get it to work.

Code:


$SongID = "Track_0"
ControlCommand("Soundboard v4", $SongID)



I could do something like this but want to avoid it if possible because this becomes static instead of dynamically driven.

Code:



if($SongID = "Track_0")
ControlCommand("Soundboard v4", Track_0)
elseif($SongID = "Track_1")
ControlCommand("Soundboard v4", Track_1)
.
.
.
endif



So the question is, how would one go about passing a variable into the SoundBoard V4 command?

Thanks for any advice in advance. This one has me stumped.

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

That should work to be honest unless there's an issue with the variable being a string but the control not asking for quotes surrounding the text.

I need to spend some quality time with a robot so give me a couple of hours and I'll play and see what I discover.

#3

Thanks Rich.

#4

I just tried everything I could think of trying to use a variable in place of the track number however had no success, which leads me to believe that it's not currently possible (however I suspect it may be once DJ sees this).

There's a challenge to the community, find out something which I failed to find (it happens, it's rare but it happens) Smile


What is it that you are trying to achieve anyway? Somewhere in the script you must be setting $songID. I know it's a little more coding (although it is click & paste) but couldn't you use the ControlCommand in place of the setting of the variable?

#5

Added to the next release

#6

The song Id is set by a call to a database. The list of songs resides there and is called at intervals. I log what has been played in the database so that the same thing isn't played again for the same person until they have completed all of them.

I'm not actually using it for songs, but stories for a teacher to use in a classroom type setting.

Thanks DJ. Also, Thanks Rich for looking.

#7

Someone who saw what had been done with Teddy last night asked if I could do the same for an office type setting. You wouldn't want the same "elevator music" played over and over again or else you might have a few less employees... It could be used for office announcements or really anything. It could be used at a store to repeat the special sales for the day, but you would want it to go through all of them before repeating them.

I also have age ranges in the database so that the call to the database retrieves the tracks that are only appropriate for the age of the user. If a first grade teacher is using the robot, it would recognize that teachers face, and only play tracks that are for 1st grade students. If the 6th grade teacher was using the robot, it would play tracks appropriate for sixth grade students.

This all goes back to the project that was for my granddaughter. I want the robot to change what it does when she is 1 vs 6 years old without me having to go make the changes in the project when she turns 6.

#8

Had to make a comment to mark it as resolved. Its going to take a modification to EZ-Builder. Rich, thanks again for looking into it. Marking as resolved as I am sure DJ will resolve it with the next release as stated.