'S artworks > Arduino' 카테고리의 다른 글
아두이노 - 버튼을 눌러 LED 제어하기 . 02 (0) | 2011.04.11 |
---|---|
아두이노 - 버튼을 눌러 LED 제어하기 . 01 (0) | 2011.04.05 |
아두이노 - 버튼을 눌러 LED 제어하기 . 02 (0) | 2011.04.11 |
---|---|
아두이노 - 버튼을 눌러 LED 제어하기 . 01 (0) | 2011.04.05 |
interactive dice - prototype from sartworks on Vimeo.
주사위 LED제어 센서 테스트 (0) | 2011.04.11 |
---|---|
인터렉티브 주사위 진행과정. (블루투스 모듈 사용하기.) (0) | 2011.04.05 |
LED control from sartworks on Vimeo.
- p r o t o t y p e (1) | 2011.04.26 |
---|---|
인터렉티브 주사위 진행과정. (블루투스 모듈 사용하기.) (0) | 2011.04.05 |
준비물
아두이노 칩 or 아트메가 168 외 아트메가들
아두이노 프로그램
LED 12개
버튼 1개
10k 저항 1개
점퍼케이블
결과
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);
}
// 더짧은 코드나 수정이 필요한 부분은 언제든 코맨드 부탁드립니다 ^^
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]));
}
}
Interaction Light - [ awake ] (1) | 2011.12.16 |
---|---|
아두이노 - 버튼을 눌러 LED 제어하기 . 02 (0) | 2011.04.11 |
Bluetooth Bee를 이용하여 PC와 연결하는 과정입니다. 2011.03.28
(블루투스 모듈에 아답타를 끼워서 브레드보드에 사용. )
*** 아두이노 보드를 사용하는거와 똑같습니다~
long DATARATE = 9600; // default data rate for BT Bee
char inChar = 0;
int LED = 13; // Pin 13 is connected to a LED on many Arduinos
void setup() {
Serial.begin(DATARATE);
// bluetooth bee setup
Serial.print("\r\n+STWMOD=0\r\n"); // set to slave
delay(1000);
Serial.print("\r\n+STNA=DSC\r\n"); // DSC = digital setting circles
delay(1000);
Serial.print("\r\n+STAUTO=0\r\n"); // don't permit auto-connect
delay(1000);
Serial.print("\r\n+STOAUT=1\r\n"); // existing default
delay(1000);
Serial.print("\r\n +STPIN=0000\r\n"); // existing default
delay(2000); // required
// initiate BTBee connection
Serial.print("\r\n+INQ=1\r\n");
delay(2000); // wait for pairing
pinMode(LED, OUTPUT);
}
void loop() {
// test app:
// wait for character,
// a returns message, h=led on, l=led off
if (Serial.available()) {
inChar = Serial.read();
if (inChar == 'a') {
Serial.print("connected"); // test return connection
}
if (inChar == 'h') {
digitalWrite(LED, HIGH); // on
}
if (inChar == 'l') {
digitalWrite(LED, LOW); // off
}
}
}
- p r o t o t y p e (1) | 2011.04.26 |
---|---|
주사위 LED제어 센서 테스트 (0) | 2011.04.11 |
BANG & OLUFSEN A8 이어폰 (7) | 2009.07.14 |
---|
강원도 해돋이 휴휴암 (0) | 2009.08.20 |
---|---|
청주 무심천 벚꽃길. (0) | 2009.08.20 |
광화문 광장 (0) | 2009.08.10 |
추암해수욕장 '촛대바위' (찬란한유산 촬영지) (2) | 2009.08.05 |
무릉계곡 (0) | 2009.08.05 |
파노라마로 세상을 바라보다. (0) | 2009.08.06 |
---|