AUTOMATIC CRADLE

Photo of author

By Jackson Taylor

MICROCONTROLLER — PIC12F508

PROGRAM
//GP5=MIC
//GP1=RELAY
#include<pic.h>
OSSCAL=0X80;
__CONFIG(0X0FEA);
#define _XTAL_FREQ 4000000
void main()
{
TRISGPIO=0X20;GPIO=0;
OPTION= 0XC0;
GP1=1;
__delay_ms(2000);
GP1=0;
while(1)
{
while(GP5==1)
{
GP1=1;
__delay_ms(2000);
}
GP1=0;
}
}

See also
BT136 - TRIAC