Week 3 Homework

Hello! Here is my homework for week 3.

Digital Input

The Serial Monitor

Two buttons control one LED

It is very interesting to write code. And here is my final code.

 
const int buttonPin1 = 2;
const int buttonPin2 = 3;
const int ledPin =  13;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
}

void loop() {

  if ((digitalRead(buttonPin1) == HIGH) && (digitalRead(buttonPin2) == LOW)) {
    digitalWrite(ledPin, HIGH);
  }

  if ((digitalRead(buttonPin1) == LOW) && (digitalRead(buttonPin2) == HIGH)) {
    digitalWrite(ledPin, LOW);
  }
}

Thank you!