-
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
-
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
---------------------------------
-
Thx Ice!
THX ICE ypur code is right!!
chip_1