'목록하단 광고 치환자(withSeok)
728x90

 

조도센스 LED 릴레이
#define DELAY_TIME 100
#define DELAY_TIME2 500
int cdsPin=0;
int cdsValue=0;

void setup() {
  // put your setup code here, to run once:
    Serial.begin(9600);
    pinMode(2,OUTPUT);
    pinMode(3,OUTPUT);   
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
    pinMode(6,OUTPUT);
    
}

void loop() {
  // put your main code here, to run repeatedly:
    cdsValue=analogRead(cdsPin);
    Serial.println(analogRead(0));
    if(cdsValue>10){
    digitalWrite(2,HIGH);
    delay(DELAY_TIME);
    digitalWrite(2,LOW);
    digitalWrite(3,HIGH);
    delay(DELAY_TIME);
    digitalWrite(3,LOW);
    digitalWrite(4,HIGH);
    delay(DELAY_TIME);
    digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(DELAY_TIME);
    digitalWrite(5,LOW);
    digitalWrite(6,HIGH);
    delay(DELAY_TIME);
    digitalWrite(6,LOW);
    digitalWrite(5,HIGH);
    delay(DELAY_TIME);
    digitalWrite(5,LOW);
    digitalWrite(4,HIGH);
    delay(DELAY_TIME);
    digitalWrite(4,LOW);
    digitalWrite(3,HIGH);
    delay(DELAY_TIME);
    digitalWrite(3,LOW);
    
    
    digitalWrite(2,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(2,LOW);
    digitalWrite(3,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(3,LOW);
    digitalWrite(4,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(5,LOW);
    digitalWrite(6,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(6,LOW);
    digitalWrite(5,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(5,LOW);
    digitalWrite(4,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(4,LOW);
    digitalWrite(3,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(3,LOW);


    digitalWrite(2,HIGH);
    delay(DELAY_TIME);
    digitalWrite(2,LOW);
    digitalWrite(3,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(3,LOW);
    digitalWrite(4,HIGH);
    delay(DELAY_TIME);
    digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(5,LOW);
    digitalWrite(6,HIGH);
    delay(DELAY_TIME);
    digitalWrite(6,LOW);
    digitalWrite(5,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(5,LOW);
    digitalWrite(4,HIGH);
    delay(DELAY_TIME);
    digitalWrite(4,LOW);
    digitalWrite(3,HIGH);
    delay(DELAY_TIME2);
    digitalWrite(3,LOW);

    }
}
728x90

+ Recent posts