User Manual
Part4.PIRsensorcontrolmotorfan
/*
PART4PIRSensorCONTROLMotorfan
Ifsomeonepassingfromthefront,thefanwillturn
*/
intpir=A0;//TheA0pin,readPIR
intmotor=6;//The6pin,drivingthemotor
voidsetup(){
pinMode(pir,INPUT);//initializethePIRpinasaninput.
pinMode(motor,OUTPUT);//initializethemotorpinasanoutput.
}
voidloop(){
if(digitalRead(pir)==HIGH){
digitalWrite(motor,HIGH);
delay(5000);//waitfor5000microsecond
digitalWrite(motor,LOW);//turnoffthemotor
}
}
Part5.LDRsensorcontrolmotorfan
/*
PART5PhotodiodesensorCONTROLMotorFan
Accordingtotheintensityoflightmotorspeedcontrol
*/