Introduction: Basic Arduino Beginning Circuit

Picture of Basic Arduino Beginning Circuit

CHECK OUT THE TECHSHOP. TECHSHOP.WS. this is going to be a basic circuit with 2 LEDs and 1 switch. we are going to be using the arduino uno. the circuit is going to perform like: when nothing is pressed the red light will stay on when the button is pressed then the led will switch to the green one will turn on.

Step 1: Whats Needed

Picture of Whats Needed

Step 2: Setting Up the Circuit

Picture of Setting Up the Circuit

here we are using 3 output pins in total pin 9 10 and 11. we are using 2 1k resistors as to not allow the LEDs to draw full power. and a drop down resistor which is a 10k resistor. setup your circuit exactly how you see it remembering to setup the vertical rails one for power and one for ground

Step 3: Programming the Arduino

Picture of Programming the Arduino

the program will run a if loop with were if the button is pressed it will set the red led to low and the green to high. if it isn't it is set green to low and red to high.

source:
int GreenLed = 11;
int RedLed = 9;
int SwitchPin = 10;

void setup()
{
  pinMode(GreenLed, OUTPUT);
  pinMode(RedLed, OUTPUT);
  pinMode(SwitchPin,INPUT);
 
}

void loop()
{
  if(digitalRead(SwitchPin) == HIGH)
  {
    digitalWrite(RedLed,LOW);
    digitalWrite(GreenLed, HIGH);
  }
  else
  {
    digitalWrite(GreenLed,LOW);
    digitalWrite(RedLed, HIGH);
  }
}

Step 4: Results

Picture of Results

when you push the button the green led turns on and when you release the red led turns off.

Comments

ragzputin made it! (author)2014-09-24

Never mind. Here's a top view of the circuit I made. Thanks anyway!

ragzputin (author)2014-09-24

Could you please put up a clear, non-blurry picture which shows the top view of this circuit? I'm not able to see anything!

About This Instructable

4,657views

35favorites

License:

More by Brucker Industries:Better Welding TipsBox FrameBasic Arduino Beginning Circuit
Add instructable to: