Help with 4 photoresistors
mightymouse
Posts: 10
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.
Comments
Can you explain this further?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
·· What do you get when you run the following program?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
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.
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
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
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
Can you post what edited code you have currently?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen