Create a project that can make the Arduino turn on an LED with the push of a button. For this assignment I will be using a tactile push button and a pull down resistor.
int btn2 = 2;
int led = 9;
void setup() {
pinMode(led, OUTPUT);
pinMode (btn2, INPUT);
}
void loop() {
if(digitalRead(btn2) == HIGH){
digitalWrite (led, HIGH);
}
else{
digitalWrite (led, LOW);
}
}
What I leaned:
Problems:
You can do it, too! Sign up for free now at https://www.jimdo.com