i want to make an automatic on off switch using pic and relay with light sensor (as in attachment) connected to adc channel 0 of pic 16f870 and relay connected to pin 0 of port c via darlington pair ic.
i have code for temperature sensor. can it be used in this project by modifying it.
unsigned char myvalue;
void main()
{
adcon0=0x85;
adcon1=0x01;
trisa=0xff;
trisc=0x00;
while(1)
{
myvalue=adc_read(0)>>2;
portc=myvalue;
delay_ms(1000);
}
}
i have code for temperature sensor. can it be used in this project by modifying it.
unsigned char myvalue;
void main()
{
adcon0=0x85;
adcon1=0x01;
trisa=0xff;
trisc=0x00;
while(1)
{
myvalue=adc_read(0)>>2;
portc=myvalue;
delay_ms(1000);
}
}
Attachments
Last edited: