|
Page 1 of 1
|
[ 6 posts ] |
|
| Author |
Message |
|
akohrs08
Rookie
Joined: Fri Feb 24, 2012 12:36 pm Posts: 4
|
 using the color sensor
Hi, I'm a college student using Mindstorms 3.05 for an engineering class, and I'm trying to get my NXT to distinguish colors. I just picked up the 6-color sensor but have no idea how to configure it. I've been looking through forums but can't find the basic sample program on ROBOTC that people seem to keep mentioning. I just need a basic way for the sensor to distinguish between red, blue, green, yellow, black, and white. Any starting points or any other form of help is greatly appreciated 
|
| Fri Feb 24, 2012 12:39 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 509 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: using the color sensor
Is this what your looking for?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Fri Feb 24, 2012 12:43 pm |
|
 |
|
akohrs08
Rookie
Joined: Fri Feb 24, 2012 12:36 pm Posts: 4
|
 Re: using the color sensor
That looks about right, where did you find this? And how do I get the top line starting with #pragma? When I go to Motors and Sensors setup, I don't have any color options. I just have No Sensor, Touch, Light Active, Light Inactive, Sound DB, Sound DBA, and SONAR. Is there a firmware problem since I don't have those color options or is there something I'm missing? When I run your code I run into a bunch of errors, too
|
| Fri Feb 24, 2012 1:07 pm |
|
 |
|
akohrs08
Rookie
Joined: Fri Feb 24, 2012 12:36 pm Posts: 4
|
 Re: using the color sensor
I figured out how to get the top line, turns out I just had to switch to expert mode and my Lego color sensor showed up. Now I'm running into errors regarding the 'case statement not having a constant value' and another saying that the various COLOR variables are undefined and that 'short' is assumed. I'm a fairly new C user, I have some experience in Java and Matlab. Where should I be creating these variables?
|
| Fri Feb 24, 2012 1:24 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 509 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: using the color sensor
It's in the sample programs. go to "file", then "open sample program", and go to the folder "LEGO Color Sensor". It's the only program in it if your using 3.05. Did you modify the program? You might want to try replacing the "COLOR" things with the numbers 1-6. Like this: Both this and the original code work fine for me.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Fri Feb 24, 2012 1:37 pm |
|
 |
|
akohrs08
Rookie
Joined: Fri Feb 24, 2012 12:36 pm Posts: 4
|
 Re: using the color sensor
Sounds good, I'll give that a try and see if I have any more issues. Thank you very much!
|
| Thu Mar 01, 2012 1:20 pm |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|