PDA

View Full Version : Help with 4 photoresistors



mightymouse
02-18-2010, 01:01 AM
I have a boe bot and I am trying to use 4 photoresistors. I know that the photoresistors are working properly but when I try to use them in another program, the boe bot goes crazy and one of the photoresistors is showing that it sees a shadow but its not. I have attached the program to this thread.

Franklin
02-18-2010, 08:19 AM
[quote]the boe bot goes crazy
Can you explain this further?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

JD
02-18-2010, 09:25 AM
Mightymouse,

Could you please take a picture of the setup you have? That way we can confirm the wiring as well as the program. Also, does this erratic operation happen regardless of the photo-resistors used? For example, can you swap the photo-resistors around to see if the Boe-Bot operates the same way or if the strange activity would follow a certain sensor?

You can use the Attachment Manager to upload the picture if possible.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

mightymouse
02-18-2010, 11:33 AM
For now, the Boe-Bot moves regardless if there is light or not and it does not matter if the photo-resistors are swapped

mightymouse
02-18-2010, 10:51 PM
This picture from the book will have to do because it will be a while before I can take a actual picture. My design is just as the board is in the picture but I have no piezospeaker and there are 2 more photo-resistors. The ground is in series and so is the power

Franklin
02-19-2010, 06:07 AM
Try adding debug statements to the subroutines to see what is running and what is not. The diagram won't work with your code though so no help there.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

JD
02-19-2010, 08:23 AM
Mightymouse,

What do you get when you run the following program?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Dave-W
02-20-2010, 07:29 AM
Mightymouse,
You check to see if 3, 6, 9, and 12 are low but in your Elseif you do not check for 3 and 6 being high then 9 and 12 being high.
You will always get a true for 3 and 6 even if 9 and 12 are high.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave W.

mightymouse
02-22-2010, 11:40 PM
so i need to add.... to the end?

ELSEIF (IN3 = 1) AND (IN6 = 1) AND (IN9 = 1) AND (IN12 = 1)
GOSUB Forward_Pulse


like this?

DO
IF (IN6 = 0) AND (IN3 = 0) AND (IN9 = 0) AND (IN12 = 0) THEN 'Pin 3, 6, 9, 12
GOSUB Back_up
GOSUB Turn_Left
GOSUB Turn_Left
ELSEIF (IN12 = 0) OR (IN9 = 0) THEN 'two photoresitors on the right side
GOSUB Back_Up
GOSUB Turn_Right
ELSEIF (IN3 = 0) OR (IN6 = 0) THEN 'two photoresistors on the left side
GOSUB Back_Up
GOSUB Turn_Left
ELSEIF (IN3 = 1) AND (IN6 = 1) AND (IN9 = 1) AND (IN12 = 1)
GOSUB Forward_Pulse

ENDIF

LOOP

mightymouse
02-25-2010, 11:16 PM
Help anyone?

JD
02-26-2010, 01:34 AM
mightymouse,

Yes, you would need to add the commands to check any of the buttons that you want to have in in the project. However, by using AND, that means the command will require all those buttons to be pressed to trigger the event.

Did you want something like the following?
6 = go forward
3 =go back
12 =go left
9 = go right

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

mightymouse
02-27-2010, 06:12 AM
the pins go from 15 - 0

so if 12 and 9 are low, then it will turn right
if 6 and 3 are low, then it will turn left
and if all the photoresistors do not see shade, then it will keep going forward

mightymouse
02-27-2010, 06:12 AM
and i know if i use "AND" then all of them must be "0" in order to go forward

JD
03-04-2010, 04:15 AM
Mightymouse,

Can you post what edited code you have currently?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

mightymouse
03-04-2010, 08:12 AM
here is the program i am using

Franklin
03-04-2010, 09:02 AM
You have a dectector on pin 12> (and a servo?)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen