Material Needed:
1 x Arduino Board
1 x Breadboard
1 x Laptop
1 x USB Cable
1 x LED
1 x 330Ω Resistor
Push Button |
1 x 10kΩ Resistor
7 x Jumper Wires
Codes( Part I):
const int button = 11;
const int led = 4;
int buttonState = LOW;
void setup()
{
pinMode(led, OUTPUT);
pinMode(button, INPUT);
}
void loop()
{
buttonState = digitalRead(button);
if (buttonState == HIGH)
digitalWrite(led, HIGH);
else
digitalWrite(led, LOW);
}
No comments:
Post a Comment