|
Page 1 of 1
|
[ 3 posts ] |
|
Author |
Message |
amullen98
Rookie
Joined: Sun Mar 11, 2012 11:15 pm Posts: 3
|
 Finding a Candle
Hey,
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; wait1Msec(1000); checkLight(); motor[motorC] = 100; motor[motorB] = 100; wait1Msec(5000); }
void checkLight() { if (SensorValue(light) > 60) { while (SensorValue(Sonar) > 15 ) { motor[motorC] = 25; motor[motorB] = 25; } }
else motor[motorC] = -25; motor[motorB] = 50; return; }
|
Sun Mar 11, 2012 11:22 pm |
|
 |
mwinders
Rookie
Joined: Sat Mar 10, 2012 4:09 pm Posts: 4
|
 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. http://www.burk.com/Products/Afd1.aspxGood luck!!! Mike Reno Robot Club
|
Sun Mar 11, 2012 11:53 pm |
|
 |
amullen98
Rookie
Joined: Sun Mar 11, 2012 11:15 pm Posts: 3
|
 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 |
|
|
|
Page 1 of 1
|
[ 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
|
|