ColorSounds

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

ColorSounds

Postby cfin » Fri Dec 13, 2013 11:35 am

Hello,
I played around with the EV3ColorTest example.
After some modifications, because some colors were missing, its working now. But I could not hear the sounds.
Since I get the return value 9, I think, the files are missing.

Can somebody say, where the soundfiles should be?

Additionally it would make sense, to check in the method playSample if, the given file exists before asking for its length. Then you could return a different error code.

thankyou
cfin
New User
 
Posts: 15
Joined: Fri Oct 25, 2013 8:04 pm

Re: ColorSounds

Postby gloomyandy » Fri Dec 13, 2013 12:40 pm

The files have not been uploaded. You just need a bunch of wav files in the directory that the program is run from. I did not upload them because there is no easy way to get them to the ev3 and this was just a quick test program. This sample will probably get deleted or updated at some point. What colors are missing? Good suggestion about checking to see if the file already exists.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3900
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: ColorSounds

Postby cfin » Fri Dec 13, 2013 1:58 pm

Hi, in the sample class only these colors exist:
{ "None", "Black", "Blue", "Green", "Yellow", "Red", "White" }
But the ev3 sensor seem to know these colors:
RED(0), GREEN(1), BLUE(2), YELLOW(3), MAGENTA(4), ORANGE(5), WHITE(6), BLACK(7), PINK(8), GRAY(9), LIGHT_GRAY(
10), DARK_GRAY(11), CYAN(12), BROWN(13), NONE(-1)

So, when the color sensor sees the color brown, it returns 13 and then an ArrayIndexOutOfBoundsException occurs.
cfin
New User
 
Posts: 15
Joined: Fri Oct 25, 2013 8:04 pm

Re: ColorSounds

Postby gloomyandy » Fri Dec 13, 2013 2:59 pm

Actually the EV3 color sensor can only identify 7 colors (plus none). See this page:
http://www.ev-3.net/en/archives/847
However some other color sensors can identify a wider range of colors and in leJOS we convert the readings from the Lego sensor into this wider set (I'm pretty sure that the test code you have been looking at only used the raw values from the sensor, the sensor driver has changed since I wrote that code).

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3900
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to EV3 Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff