
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
Содержание KS0077
Страница 1: ...keyestudio www keyestudio com 1 Super Learning Kit for Arduino...
Страница 14: ...keyestudio www keyestudio com 14 Connection for UNO R3 Connection for 2560 R3...
Страница 21: ...keyestudio www keyestudio com 21 Circuit Connection Connection for UNO R3 Connection for 2560 R3...
Страница 32: ...keyestudio www keyestudio com 32 Connection for 2560 R3...
Страница 35: ...keyestudio www keyestudio com 35 Circuit Connection Connection for UNO R3 Connection for 2560 R3...
Страница 42: ...keyestudio www keyestudio com 42 Connection for MEGA 2560...
Страница 45: ...keyestudio www keyestudio com 45 Connection for UNO R3 Connection for 2560 R3...
Страница 59: ...keyestudio www keyestudio com 59 Connection for 2560 R3...
Страница 66: ...keyestudio www keyestudio com 66 Connection for 2560 R3...
Страница 72: ...keyestudio www keyestudio com 72 Manual for LED Segment Display Connection for UNO R3...
Страница 85: ...keyestudio www keyestudio com 85 8 bit Connection Method Connection for UNO R3...
Страница 94: ...keyestudio www keyestudio com 94 Connection for 2560 R3 Connect the motor to digital pin 9...
Страница 105: ...keyestudio www keyestudio com 105 Circuit Connection Connection for UNO R3 Connection for MEGA 2560 R3...