light blocking sensor
//click read more to get full coding friends
//light blocking sensor coding
//this coding belongs to pradeep royal creation youtube channel
int Led=13;//define the led's(also use buzzer) port
int sensor =3; //define the port of light blocking module
int val;//define digital variable val
void setup()
{
pinMode(Led,OUTPUT);//define digital variable val
pinMode(sensor ,INPUT);//define light blocking module as a output port
}
void loop()
{ val=digitalRead(sensor);//read the value of the digital interface 3 assigned to val
if(val==HIGH)//when the light blocking sensor have signal, LED blink
{
digitalWrite(Led,HIGH);
}
else
{
digitalWrite(Led,LOW);
}
}
Comments
Post a Comment