Shop OBEX P1 Docs P2 Docs Learn Events
suggestions? please help? — Parallax Forums

suggestions? please help?

ArchiverArchiver Posts: 46,084
edited 2002-10-06 01:41 in General Discussion
i made 3 of the outputs of the stamp to make LEDs
light up in binary from ooo to 111 incrementing and
decrementing.
my question is how do make count in steps depending on
3 inputs (2 are buttons). if any of 2 of the buttons
are pressed and shows an active high, i want the LEDS
to increment from 001 to 010 only. if the buttons are
pushed again then it will go up again from 010 to 011
and stay until another change from the input is made.
any suggestion?

>


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-10-05 22:34
    Yup. one way is to add the pins to your counter. Detect when the button is
    pressed and then add or subtract the pin from the count. You may need to
    program in a delay as well, but it does work.

    Did this on a BS1 recently for a project to test / adjust servos. The
    buttons change the pulse length going to the servos. This is an example of
    how to do it.

    Cnt = Cnt + PIN1
    Cnt = Cnt - PIN2

    Original Message

    > i made 3 of the outputs of the stamp to make LEDs
    > light up in binary from ooo to 111 incrementing and
    > decrementing.
    > my question is how do make count in steps depending on
    > 3 inputs (2 are buttons). if any of 2 of the buttons
    > are pressed and shows an active high, i want the LEDS
    > to increment from 001 to 010 only. if the buttons are
    > pushed again then it will go up again from 010 to 011
    > and stay until another change from the input is made.
    > any suggestion?
  • ArchiverArchiver Posts: 46,084
    edited 2002-10-06 01:41
    thanx for replying.
    heres my sample program that i'm using for my school
    project. i'm a rookie at using the basic stamp so i
    appreciate any advice. thanks again. to give a brief
    description of my project:
    -my 3 inputs will be all active lows when normal
    condition and so would be the output pins
    -my 3 outputs will be connected to a 3to8
    decoder...i've reading example source codes and it's
    almost the same as using a stepper motor as far as the
    outputs are concern but all of the examples are in
    sequence. i mean that it different from what i need.
    i know how to make an led to do sequence but i dont
    know how to make it on command (stop and go)
    -the 3 outputs are stable when its 000 and its max 111
    -when the inputs detects a high, i want the output to
    go up 1 and stay there until the next logic 1.

    problem:
    -i've gotten my output to count.
    -i'm lost as far as getting it to increment and have
    it stay there until the next condition.
    -i've tried BUTTONS and BRANCH commands and it didn't
    work because i couldn't get it to stay at a stage. the
    whole program would restart.
    -the biggest problem is my lack of understanding of
    the pbasic language...i admitted!

    thanks once again!




    __________________________________________________
    Do you Yahoo!?
    Faith Hill - Exclusive Performances, Videos & More
    http://faith.yahoo.com
Sign In or Register to comment.