EasyManua.ls Logo

Keyestudio KS0079 - Project 14: IR Remote Control

Default Icon
142 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
keyestudio
www.keyestudio.com
49
while(1)
{
i=analogRead(5);// read the voltage value of analog pin 5
if(i>512)// if larger that 512(2.5V)
{
digitalWrite(8,LOW);// turn on LED
}
else// otherwise
{
digitalWrite(8,HIGH);// turn off LED
}
}
}
//////////////////////////////////////////////////////////
Test Result
Hold the breadboard with your hand. Tilt it to a certain extent, the LED will be on. If there is no
tilt, the LED will be off.
The principle of this experiment can be also applied to relay control.
Experiment now is completed. Thank you!
*******************************************************************************
Project 14: IR Remote Control