Shop OBEX P1 Docs P2 Docs Learn Events
need for project - controlling lighting brighting — Parallax Forums

need for project - controlling lighting brighting

mshaheenmshaheen Posts: 3
edited 2010-06-19 21:41 in BASIC Stamp
Good evening all


I need yours help in my project which is controlling lighting bighting brightness using thies main ideas

sensor reading the amount of brighness
the microcontroller checking the reading ( we are goning to use many modes - study - normal - sleeping and happy mode )
increase or decrease the brighting using variable resistance ( digital resistans )
I am waiting for your help wich is the cercuit and the programming code


Thanks

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-06-18 22:00
    Somebody said...
    I am waiting for your help wich is the cercuit and the programming code
    The circuit and code is for you to create. If after you have created something and posted your code and circuit drawing here you still have questions feel free to ask them. If you don't want to spend the effort to build and learn how to control this device then pick something you are interested in that you are willing to build.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • mshaheenmshaheen Posts: 3
    edited 2010-06-19 08:52
    I have the first part that reading the brighting of light
    but the second part wich is increase or decrease the brighting i dont have it
  • FranklinFranklin Posts: 4,747
    edited 2010-06-19 18:37
    You have not yet posted your code or circuit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • mshaheenmshaheen Posts: 3
    edited 2010-06-19 19:48
    I HAVE THIS CODE
    BUT IT DOSNT WORKING
    CAN U TELL ME WHAT IS THE PROBLEM WITH


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}




    UDPIN CON 5
    CLKPIN CON 6
    PHOTOPIN CON 2
    DELAYPULSES CON 10
    DELAYREADER CON 2000
    COUNTER VAR Byte
    OLDTAPSETTING VAR Byte
    NEWTAPSETTING VAR Byte
    LIGHTREADING VAR Word
    TIME VAR Word

    OLDTAPSETTING = 0
    NEWTAPSETTING = 0

    LOW UDPIN
    FOR COUNTER = 0 TO 255

    PULSOUT 6,5
    PAUSE 1
    NEXT

    DO



    GOSUB Read_Photoresistor
    NEWTAPSETTING = LIGHTREADING
    GOSUB SET_UD_Pin
    GOSUB PULSE_CLK_PIN
    LOOP

    SET_UD_PIN:
    IF NEWTAPSETTING > OLDTAPSETTING THEN
    ELSEIF NEWTAPSETTING < OLDTAPSETTING THEN
    LOW UDPIN
    ENDIF
    RETURN

    PULSE_CLK_PIN:
    FOR COUNTER = OLDTAPSETTING TO NEWTAPSETTING
    PULSOUT CLKPIN, 1
    PAUSE DELAYPULSES
    NEXT
    OLDTAPSETTING = NEWTAPSETTING
    RETURN

    READ_PHOTORESISTOR:
    HIGH PHOTOPIN
    PAUSE 100
    RCTIME PHOTOPIN, 1, LIGHTREADING
    DEBUG HOME, "LIGHTREADING = ", DEC5 time

    RETURN



    NOTE: I WILL ATTACH THE CERCUIT LATER
  • FranklinFranklin Posts: 4,747
    edited 2010-06-19 21:41
    SET_UD_PIN:
    IF NEWTAPSETTING > OLDTAPSETTING THEN [color=#990000]<<<==??[/color]
    ELSEIF NEWTAPSETTING < OLDTAPSETTING THEN
    LOW UDPIN
    ENDIF
    RETURN
    
    



    What is that supposed to do? It looks like you're missing a part.

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