IR detector


Results 1 to 29 of 29

Thread: IR detector

Threaded View

  1. #6
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    I guess this is where I get confused with electronics.
    I can take a 9V battery and use a resistor to run a 1.5V led without problem but I can't use a resistor the same way to run a 5V chip.

    This seems to make sense to everyone but me lol

    Ok on to the coding would this chip be able to handle the timer part of this or would I need a dedicated timer chip?

    My guess is that there will be about 100 breaks in the beam in a 30 second time.

    Currently I'm testing with this code and a led on RB1.
    Main:
    if PORTB.0 = 1 then
    high PORTB.1
    else
    low PORTB.1
    endif


    Now that looks like it will work fine but, if the loop happens more than once before the bean is brought back it could count 10 times for every break...

    Would this code work and only count once?

    broken var byte
    broken = 0
    Main:
    if PORTB.0 = 1 and broken = 0 then
    broken = 1
    high PORTB.1
    else
    low PORTB.1
    endif
    if PORTB.0 = 0 and broken = 1 then broken = 0

    goto Main
    Last edited by geckogrotto; - 16th August 2006 at 19:32.

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 03:17
  2. PIC10F200 Automated IR Light Switch
    By Bruce in forum Code Examples
    Replies: 7
    Last Post: - 3rd May 2007, 12:40
  3. Replies: 10
    Last Post: - 16th October 2006, 19:23
  4. how to get pic to pic communication
    By kinsiro in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th August 2005, 18:12
  5. IR for robot on 16F877A
    By Samuel in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 9th April 2005, 21:57

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