GP2D15 sharp


Closed Thread
Results 1 to 3 of 3

Thread: GP2D15 sharp

  1. #1
    chip_1's Avatar
    chip_1 Guest

    Default GP2D15 sharp

    How to use GP2D15 sensor?
    show my code:

    pic 16f84a
    picbasic pro

    --------------------------------

    start:

    input portb.1
    if portb.1 = 1 then led

    led:

    high portb.3
    pause 1000
    low portb.3
    pause 1000
    goto start
    ---------------------------------


    but not works... possible solution?



    THX
    by
    chip_1

  2. #2
    ice's Avatar
    ice Guest


    Did you find this post helpful? Yes | No

    Default remove the pauses

    chip_1,

    Try this..remove the pauses from your program and declare your input and output pins.

    --------------------------------
    TRISB=%11110111 'make portb.1 and input and portb.3 an output

    start:
    if portb.1 = 1 then led
    else
    portb.3=0
    goto start

    led:
    portb.3 =1
    goto start
    ---------------------------------

    OR a smaller version would be without the subroutine LED
    TRISB=%11110111 'make portb.1 and input and portb.3 an output

    start:
    if portb.1 = 1 then
    portB.3=1
    else
    portb.3=0
    endif
    goto start
    ---------------------------------
    Last edited by ice; - 14th May 2005 at 08:45.

  3. #3
    chip_1's Avatar
    chip_1 Guest


    Did you find this post helpful? Yes | No

    Default Thx Ice!

    THX ICE ypur code is right!!

    chip_1

Similar Threads

  1. Sharp ir distance sensor
    By hasnannordin in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th October 2009, 21:48
  2. Sharp GP2D02
    By Alby in forum Off Topic
    Replies: 5
    Last Post: - 8th March 2009, 08:09
  3. Sharp GP2D12 Range Finder???
    By Gixxer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 13th December 2007, 09:21
  4. Sharp GP2D12 8bit
    By Argo in forum mel PIC BASIC
    Replies: 0
    Last Post: - 25th October 2007, 23:40
  5. sharp GP2D12 interface pic16f676
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th April 2006, 17:26

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