light seeking program help
noobmuncher
Posts: 124
Hello, I am new to BS2 programing and i am looking for some help on a portion of my robots program that allows it to seek light.
I have a photo resister mounted on top of a rotating head (servo controlled) and i am trying to make the head turn the full rotation of the servo (all the way from left to all the way from right/ or preferably from center out each direction) and measure the light levels at say 4 different positions. Then depending on which area has the highest value go into driving in that direction. I have read this section in the Boe bot text except that is using multiple light sensors and to save I/0 ports i would prefer to use one and a servo. I will also use a modification of this program for PING object avoidance later on in my project.
So my question is how do i get it to record the light levels at 4 different positions and compare those 4 values to find the highest one?
Thanks for any help you provide!
Post Edited (noobmuncher) : 3/16/2008 9:27:18 AM GMT
I have a photo resister mounted on top of a rotating head (servo controlled) and i am trying to make the head turn the full rotation of the servo (all the way from left to all the way from right/ or preferably from center out each direction) and measure the light levels at say 4 different positions. Then depending on which area has the highest value go into driving in that direction. I have read this section in the Boe bot text except that is using multiple light sensors and to save I/0 ports i would prefer to use one and a servo. I will also use a modification of this program for PING object avoidance later on in my project.
So my question is how do i get it to record the light levels at 4 different positions and compare those 4 values to find the highest one?
Thanks for any help you provide!
Post Edited (noobmuncher) : 3/16/2008 9:27:18 AM GMT
Comments
With a standard servo it'd be fairly easy... you can either store the four light levels in variables or in EEPROM.
Just move the servo to point A then store the results of an RCTIME into a variable, then point B and so on.
Later you can use a series of if statements to compare the variables.
This method won't work with a continuous rotation (modified) servo though.
I'm not sure which method would be best for a continuous rotation servo... I'm having a related problem with
my robot as I only have continuous rotation servos, no standard ones.
Perhaps a simple encoder wheel?
and the sensor work well enough for object avoidance? Or do i have to have my robot fun into things with whiskers until i buy a proper distance detecting module. i got the idea from the Boe Bot "Robotics" textbook, even though i am not working with a Boe Bot.
This is a typical detector for pulsed IR: www.parallax.com/Store/Components/Optoelectronics/tabid/152/CategoryID/30/List/0/SortField/0/Level/a/ProductID/177/Default.aspx.
It works quite well for distance detection and object detection. The BoeBot manual has examples of this. Also look at IR Remote with the BoeBot.