Led on off using push button - Wired Connection - Arduino
Arduino + LED(Light) + Push Button - Wired Connection
Circuit Diagram:
Required Components:
1) Arduino Uno/Nano - 2 Nos.
2) Battery - 9v - 2 Nos.
3) LED - 1 Nos.
4) Push Button - 1 Nos.
5) 470K Resister - 1 Nos.
6) 10K Resister - 1 Nos.
Codes:
int switchPin = 7;
int ledPin = 8;
void setup() {
pinMode(switchPin,INPUT);
pinMode(ledPin,OUTPUT);
}
void loop() {
if(digitalRead(switchPin)==HIGH)
{
digitalWrite(ledPin,HIGH);
}
else{
digitalWrite(ledPin,LOW);}
}
Video:
Comments
Post a Comment