25 lines
503 B
Plaintext
25 lines
503 B
Plaintext
' ########### start ###########
|
|
' pic:PIC16F886
|
|
' ########### end ###########
|
|
|
|
'This program monitors a photoresistor connected
|
|
' to the AN1 pin. If its in the dark it will
|
|
' light the LED on D13. If its in the light
|
|
' then LED is shutoff.
|
|
|
|
'Chip Settings
|
|
#chip 16F886,16
|
|
#include <chipino.h>
|
|
Dir D13 out 'Make D15 pin output
|
|
Start:
|
|
Do
|
|
'Light LED if in the dark
|
|
If ReadAD(AN1) < 150 Then
|
|
set D13 on 'Sensor is Dark
|
|
else
|
|
set D13 off 'Bright light on sensor
|
|
end if
|
|
|
|
Loop
|
|
|