Circuit:



Code:



#include<reg51.h> 
sbit motor=P1^0; 
void delay(); 
void delay(unsigned int time) {    
    int i,j;   // delay 1s     
    for(i=0;i<time;i++)  
    for(j=0;j<1105;j++); 
}   
void main(){     
    while(1){         
        delay(100);         
        motor= 0xff;         
        delay(100);         
        motor = 0x00;     
    } 
}