Input/Output – Eugenia Ramos

Digital Input

The Serial Monitor

2 Buttons – On/Off

int ledPin = 13; 
int inputPin1 = 3; 
int inputPin2 = 2; 
 
void setup() {
  pinMode(ledPin, OUTPUT); 
  pinMode(inputPin1, INPUT_PULLUP); 
  pinMode(inputPin2, INPUT_PULLUP); 
}
 
void loop(){
  if (digitalRead(inputPin1) == LOW) {
    digitalWrite(ledPin, LOW); 
  } else if (digitalRead(inputPin2) == LOW) {
    digitalWrite(ledPin, HIGH); 
  }
}

 

One thought on “Input/Output – Eugenia Ramos”

Comments are closed.