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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Whats Needed
Step 2: 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
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.
int GreenLed = 11;
int RedLed = 9;
int SwitchPin = 10;
if(digitalRead(SwitchPin) == HIGH)
Step 4: Results
when you push the button the green led turns on and when you release the red led turns off.
1 Person Made This Project!
ragzputin made it!