아두이노 LED 실습 (Adr-002)


2015학년도 2학년 2학기/아두이노

Written by 긍지높은취객 긍지높은취객 on 2015.09.11 14:47

 

 

 

실습일 : 2015.9.11

실습시간 : 14:30 경

 

 

---

 


void setup() {
  // initialize digital pin 13 as an output.
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {

    for(int i=8;i<12;i++)
    {
      digitalWrite(i, HIGH);
      delay(300);
    }

    for(int i=11;i>7;i--)
    {
      digitalWrite(i, LOW);
      delay(200);
    }
 
//  digitalWrite(8, HIGH); 
//  delay(300);    
//  digitalWrite(9, HIGH); 
//  delay(300); 
//  digitalWrite(10, HIGH); 
//  delay(300);         
//  digitalWrite(11, HIGH);   
//  delay(300);
//
//  digitalWrite(11, LOW);   
//  delay(200);
//  digitalWrite(10, LOW);   
//  delay(200);
//  digitalWrite(9, LOW);   
//  delay(200);
//  digitalWrite(8, LOW);   
//  delay(200); 
               
 
  digitalWrite(13, HIGH); 
  delay(1000);            
  digitalWrite(13, LOW); 
  delay(500);          
}

신고