I used the below code to detect whether or not a ball is red blue green etc. But everytime i run it on the nxt block it continues to show this "???". I need help, i dont see were the code could have gone wrong.

Also, you never defined "colorport". The line at the top does that. Replace the "S1" in it with whichever port your sensor is plugged into. i.e. S2 for port two, S3 for port three, etc.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Tue May 22, 2012 8:45 am

kelsowatsey

Rookie

Joined: Tue May 22, 2012 7:47 amPosts: 5

Re: Mindstorms color sensor using RobotC

Thanks, i am currently in a differend class right now but i will try it out tomorrow. My teacher did get the sensor from the hitechnic website. I got this code from a moderator on a website called bot bench. heres the link to it.http://botbench.com/blog/2011/02/16/rob ... ur-sensor/

That code is for the LEGO Colour Sensor, not the HiTechnic Colour Sensor. You're going to want to check out HTCS2-test*.c examples that come with the driver suite. More info on the suite itself and how to get it working, etc, can be found on the same site you got this example from: http://botbench.com/blog/robotc-driver-suite/

Ok, the driver tests work great, but now i need to add motor commands. So when it senses a green it does one thing and when it senses a red it does another. how would i go about doing that with the sample code? A fellow classmate used code similar to the above code posted and included his motor commands inbetween the color and break section for each color, but since that is not in the sample code i dont know how id go about doing that.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum