interaction light


인터렉션(Interaction)을 통해 전달되는 빛(Light)의 교감. 
 




 

living light


작품명 . Awake





interaction light


잠들지 않았다, 손끝에서 느껴지는 정전을 감지하면 잠에서 깨어 빛과의 교감이 시작된다.


























Physical Computing



Physical Computing




준비물
아두이노 칩 or 아트메가 168 외 아트메가들
아두이노 프로그램
LED 12개
버튼 1개
10k 저항 1개
점퍼케이블


결과





회로구성
2~13번 디지털핀에 LED
16번 핀에 버튼과 10k 저항 연결



아두이노 코드

int pinArray[] = {2,3,4,5,6,7,8,9,10,11,12,13};
int count = 0;
int timer = 100;
int switchIn = 16;
int cons=0;


void setup(){
  for (count=0;count<12;count++) {
    pinMode(pinArray[count], OUTPUT);
  }
  pinMode(switchIn, INPUT);
}
void loop() {
  for (count=cons; count<12; count++) {
    if (digitalRead(switchIn)==1){
      cons = count;
      if(cons == 11){
        cons = 0;
      }
      light(count);
    }
  }
  for (count=cons; count>=0; count--) {
    if (digitalRead(switchIn)==0){
      cons = count;
      if(cons == 0){
        cons = 11;
      }
      light(count);
    }
  }


int light(int x){
    digitalWrite(pinArray[x], HIGH);
 
    for (int i = 0; i < x; i++){
        digitalWrite(pinArray[i], LOW);
    }   
    for (int j = 11; j > x; j--){
        digitalWrite(pinArray[j], LOW);
    }
    delay(timer); 
}


// 더짧은 코드나 수정이 필요한 부분은 언제든 코맨드 부탁드립니다 ^^

'S artworks > Arduino' 카테고리의 다른 글

Interaction Light - [ awake ]  (1) 2011.12.16
아두이노 - 버튼을 눌러 LED 제어하기 . 01  (0) 2011.04.05

2011.04.04


준비물
아두이노 칩 or 아트메가 168 외 아트메가들
아두이노 프로그램
LED 6개
버튼 6개
10k 저항 6개
점퍼케이블


결과





회로도

 





아두이노 코드

int LED[] = {8,9,10,11,12,13}; // LED
int SEN[] = {2,3,4,5,6,7}; // 버튼
int count;

void setup(){
  //Serial.begin(9600);
  for (count=0;count<6;count++) {
    pinMode(LED[count], OUTPUT); //led setup 6EA
    pinMode(SEN[count], INPUT);  // 버튼 setup 6EA
    // digitalWrite(LED[count],LOW); // setting LOW
  }
}

void loop() {
  for(count=0; count<6; count++){
     digitalWrite(LED[count], digitalRead(SEN[count]));
  }
}



'S artworks > Arduino' 카테고리의 다른 글

Interaction Light - [ awake ]  (1) 2011.12.16
아두이노 - 버튼을 눌러 LED 제어하기 . 02  (0) 2011.04.11

+ Recent posts