본문 바로가기
아두이노

아두이노 버튼 누르면 불 들어오기

by chaechaekim 2019. 9. 6.

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

void loop() {
  // put your main code here, to run repeatedly:
  int btnstate = digitalRead(12);
  if(btnstate ==0){
    digitalWrite(13,LOW);
  }
  else{
    digitalWrite(13,HIGH);
  }
  delay(100);
}

 

* github.com/cybermin/appiot 자료 참고

댓글