View unanswered posts | View active topics It is currently Mon Feb 08, 2016 7:26 pm

Reply to topic  [ 4 posts ] 
Light Sensor as object recognizer? 
Author Message

Joined: Wed Apr 30, 2008 1:50 pm
Posts: 3
Location: Burnaby, BC
Post Light Sensor as object recognizer?
The title says it all, I want to be able to use the light sensor as a way to determine whether or not my robot will fall off the table (and yes, this has happened already.. hehe).

Does any one have any thoughts/has anyone been able to get this to work?


Sat May 10, 2008 9:07 pm

Joined: Sun May 04, 2008 2:20 pm
Posts: 2
Use the try me program to determine what it reads when the sensor is on the table, and when it isabove the floor. I think it will read a higher value when the sensor is not on the table.

Now you want your program to check whether the sensorvalue of the lightsensor is above the limit you chose with the help of the try me program. When it does, that means the light sensor is off the table.

Now you'd better stop or reverse the motors :)

EDIT: For this to work, the sensor must be positioned in such a way, that it will be close to the surface of the table, and so that it will hover above the floor, before the robot falls off the table

Sun May 11, 2008 5:47 am

Joined: Wed Apr 30, 2008 1:50 pm
Posts: 3
Location: Burnaby, BC
Post Figured some stuff out...

Thanks for your reply... I managed to figure some stuff out last night, and wanted to post what to do for people in similar situations...

first of all find out what colour of surface you are using, because you can't go from dark to light, surfaces with the same code, unless if you make a whole bunch of conditional statements. (you can find out the values simply by using the test program on your NXT).

Then from there you need to develop an initial sensor that is assumed to be at the same as the table (tip: redo at the beginning of each run), then evaluate throughout your program (most helpful to do as a function) based on your initial condition.

If any has any questions about this I can try to help ya out...


Sun May 11, 2008 5:18 pm
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
I love these kind of projects :-)

One thing I have seen from these types of projects, people try to program the current light conditions manually and then have to go and reprogram the robot when the light conditions change. I suggest having the robot read the light conditions when it starts the program, and then react when it reads values outside of a programed range. That can help reduce allot of if statements, but involves more variables.

Good luck with your project B-)

Mmmm Legos B-)

My Robot Projects:

Mon May 12, 2008 2:51 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.