need for project - controlling lighting brighting
mshaheen
Posts: 3
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
but the second part wich is increase or decrease the brighting i dont have it
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
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
What is that supposed to do? It looks like you're missing a part.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen