Detecting night time


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    down south
    Posts
    90


    Did you find this post helpful? Yes | No

    Default

    with my hobby projects I use a 10k pot,1k safety resistor and 10k photo cell
    you can add a little "debounce delay " for the headlights and cal with the pot

    Code:
      LDR=1                         'POWER UP LIGHT SENSOR
     Pause 20 
     ADCIN 0,NIGHT                 'READ AN1 & STORE IN NIGHT VAR
      PAUSE 250
     IF NIGHT=<400 then  IT'S DAY SO DO THIS
      IT'S NIGHT SO DO THIS
     Pause 25                   
     
      LDR=0             'MAKE SURE LDR/ADCIN POWER IS OFF
    " be nice it's people like me that make people like you look smart"
    yes I read the datasheet, of the 300 pages I understood 10

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Here is an example of a delay to avoid headlight induced lights off.
    Code:
    LIGHTS VAR PORTA.0
    DAY    VAR PORTA.1
    
    MAIN:
    IF DAY = 1 THEN
    PAUSE 10
    IF DAY = 1 THEN
    LIGHTS = 0
    ELSE
    ENDIF
    ENDIF
    LIGHTS = 1
    GOTO MAIN
    
    END
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 03:55
  2. Measuring time
    By AugustoPedrone in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st July 2007, 00:46
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 20:55
  4. Alarm Time
    By Santana in forum Code Examples
    Replies: 1
    Last Post: - 8th December 2006, 14:58
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 15:24

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts