반응형

 

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  pinMode(5, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  int btn = digitalRead(5);
  if(btn ==1){
    digitalWrite(13,HIGH);
  }
  else{
    digitalWrite(13,LOW);
  }

  delay(100);
}

불이켜진 상태
스위치를 누르지 않은 상태

반응형

+ Recent posts