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

Popular posts from this blog

Servo motor controlled by Joystick using Arduino & Transceiver - Wireles...

DC motor controlled by Joystick using Arduino & L298N Motor driver - Wireless Connection

DC motor controlled by Gyro MPU 6050 using Arduino & L298N Motor driver - Wired Connection