Shop OBEX P1 Docs P2 Docs Learn Events
Newbie BOE question — Parallax Forums

Newbie BOE question

stouchstouch Posts: 2
edited 2007-01-21 18:06 in BASIC Stamp
Hi, apologies for the simple question but i am working my way through the what is a microcontroller publication after purchasing a BOE kit but i seem to have hit a brick wall,

I am looking to have a pushbutton operate a servo to turn through 90 degrees which on its own isnt a problem, where i am struggling is IF it is dark at the time i would like to have an LED turn on also, could someone please shed some light on how i would incorporate this into the program before i pull what little hair i have left out [noparse]:)[/noparse]

Many thanks in advance·

Comments

  • AmaralAmaral Posts: 176
    edited 2007-01-21 17:35
    Stouch , Let me see if I understood you correct.

    When you a push a botton the servo move 90 degrees - this part you have done suceffuly ( right or wrong ? )

    and if is DARK (no lights) a led will go on ! - for this part you can use rctime command with a LDR and a Capacitor checking for light level.

    But lets go easy here , Did I understood you correct ?

    Amaral
  • latigerlillylatigerlilly Posts: 114
    edited 2007-01-21 17:45
    1. Download "Robotics With the Boe Bot" on the Parallax website.
    2. Assemble circuit on pg 51.
    3. Assemble circuit on pg 195.
    3. Use the following program:

    '{$STAMP BS2}
    '{$PBASIC 2.5}
    DO
    IF (IN6 = 0) THEN
    HIGH 12
    ELSE
    LOW 12
    LOOP

    Shameless plug:
    Please answer my question:
    http://forums.parallax.com/showthread.php?p=626915
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-01-21 17:54
    Hi stouch, I guess Amaral like myself were wondering if it was the hardware or the programming (or maybe both) that was giving you problems. In the program you would use a logical operator to check the light sensor AND button state.

    IF Button_pressed AND Its_dark THEN

    Led_on

    Move_servo

    ELSEIF Button_pressed

    Move_servo

    ENDIF

    If this is not clear to you check PBASIC Operators and the IF--THEN statement in the IDE Pbasic help file.

    Jeff T.
  • stouchstouch Posts: 2
    edited 2007-01-21 18:06
    Hi sorry, I have re read that and it wasnt very clear, Basically its the programming at the moment thats causing me the bother, I can do the individual parts such as: pushbutton moves the servo, and turns LED's on, its trying to integrate all the IF's into the circuit, I guess it'll come with practice, i have just begun experimenting, I have attached a flow chart of what Im looking to do.

    Its reprisentative of a garden gate, press a button to get in, if its dark the lights come on.

    Cheers

    Stouch
Sign In or Register to comment.