Newbie BOE question
stouch
Posts: 2
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·
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
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
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
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.
Its reprisentative of a garden gate, press a button to get in, if its dark the lights come on.
Cheers
Stouch