View Full Version : Newbie BOE question
stouch
01-22-2007, 12:27 AM
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 :)
Many thanks in advance·
Amaral
01-22-2007, 12:35 AM
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
latigerlilly
01-22-2007, 12:45 AM
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
Unsoundcode
01-22-2007, 12:54 AM
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.
stouch
01-22-2007, 01:06 AM
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