Shop OBEX P1 Docs P2 Docs Learn Events
Help with 4 photoresistors — Parallax Forums

Help with 4 photoresistors

mightymousemightymouse Posts: 10
edited 2010-03-04 01:02 in BASIC Stamp
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

  • FranklinFranklin Posts: 4,747
    edited 2010-02-18 00:19
    [noparse][[/noparse]quote]the boe bot goes crazy
    Can you explain this further?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • JDJD Posts: 570
    edited 2010-02-18 01:25
    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
  • mightymousemightymouse Posts: 10
    edited 2010-02-18 03:33
    For now, the Boe-Bot moves regardless if there is light or not and it does not matter if the photo-resistors are swapped
  • mightymousemightymouse Posts: 10
    edited 2010-02-18 14:51
    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
    900 x 1345 - 296K
  • FranklinFranklin Posts: 4,747
    edited 2010-02-18 22:07
    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
  • JDJD Posts: 570
    edited 2010-02-19 00:23
    Mightymouse,

    ·· What do you get when you run the following program?

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


    Joshua Donelson
    www.parallax.com
  • Dave-WDave-W Posts: 94
    edited 2010-02-19 23:29
    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.
  • mightymousemightymouse Posts: 10
    edited 2010-02-22 15:40
    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
  • mightymousemightymouse Posts: 10
    edited 2010-02-25 15:16
    Help anyone?
  • JDJD Posts: 570
    edited 2010-02-25 17:34
    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
  • mightymousemightymouse Posts: 10
    edited 2010-02-26 22:12
    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
  • mightymousemightymouse Posts: 10
    edited 2010-02-26 22:12
    and i know if i use "AND" then all of them must be "0" in order to go forward
  • JDJD Posts: 570
    edited 2010-03-03 20:15
    Mightymouse,

    Can you post what edited code you have currently?

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


    Joshua Donelson
    www.parallax.com
  • mightymousemightymouse Posts: 10
    edited 2010-03-04 00:12
  • FranklinFranklin Posts: 4,747
    edited 2010-03-04 01:02
    You have a dectector on pin 12> (and a servo?)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.