IoT/아두이노

(test)arduino led with button

안.들 2016. 12. 24. 17:42

refer to the site : https://www.youtube.com/watch?v=YWY_Is0L7fE

아듀이노 led 샘플.

코드
---------------------------------------------------------

int LED = 12;

int BUTTON = 4;


void setup() {

  // put your setup code here, to run once:

pinMode(LED, OUTPUT);

pinMode(BUTTON, INPUT);

}


void loop() {

  // put your main code here, to run repeatedly:

if(digitalRead(BUTTON) == HIGH)

{

     digitalWrite(LED,HIGH);

}

else

{

digitalWrite(LED,LOW);

}

}

---------------------------------------------------------