View unanswered posts | View active topics It is currently Tue Jun 19, 2018 1:39 pm

Reply to topic  [ 3 posts ] 
Finding a Candle 
Author Message

Joined: Sun Mar 11, 2012 11:15 pm
Posts: 3
Post Finding a Candle

I am working on a project and I am used ROBOTC to program my NXT robot.

For this program I need to use the light senor to locate and go to the candle but I am having trouble getting it to work.

What I need for it to do is check for light and if it finds a strong enough light source to go to the source and just quit the entire program if it does not find a strong enough light source it needs to break out and back into the main function so it can continue on to the next room.

I have the light sensor attached to the robot almost like an arm pointing straight out infront.

If you have any ideas please let me know thanks!!

#pragma config(Sensor, S1, light, sensorLightInactive)
#pragma config(Sensor, S4, Sonar, sensorSONAR)
#pragma config(Motor, motorB, RightWheel, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, motorC, LeftWheel, tmotorNormal, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

void checkLight();

task main ()
nMotorPIDSpeedCtrl[motorC] = mtrSpeedReg;
nMotorPIDSpeedCtrl[motorB] = mtrSpeedReg;

motor[motorC] = 100;
motor[motorB] = 100;


motor[motorC] = 100;
motor[motorB] = 100;


void checkLight()
if (SensorValue(light) > 60)
while (SensorValue(Sonar) > 15 )
motor[motorC] = 25;
motor[motorB] = 25;

motor[motorC] = -25;
motor[motorB] = 50;

Sun Mar 11, 2012 11:22 pm

Joined: Sat Mar 10, 2012 4:09 pm
Posts: 4
Post Re: Finding a Candle
I would recommend using a UV flame detector instead. We tried to use a light detector last year for Robogames and ambient light would alway throw us off. We are current using a Burk AFD-1. It is super simple to connect to a NXT having only a contact output. We cover the glass leaving a small hole for detection the have the bot sweep. Once we have the angles of the On/Off points we split the difference and move towards the flame to extinguish. We were able to find the Burk unit on sale at ebay for $50. It saved us a lot of time not needing to deal with ambient light.

Good luck!!!
Reno Robot Club

Sun Mar 11, 2012 11:53 pm

Joined: Sun Mar 11, 2012 11:15 pm
Posts: 3
Post Re: Finding a Candle
This is a project for a class so I can only use the senors that came with the robot which sucks because I have found so many other senors that would do the job.

Thanks for trying!

Mon Mar 12, 2012 1:52 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 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

Search for:
Jump to:  

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