'2007/10/16'에 해당되는 글 3건

  1. 2007.10.16 단순한 애니메이션
  2. 2007.10.16 아두이노 보드 지그비 확장 보드 사용법
  3. 2007.10.16 32개의 아웃풋을 지원하는 보드 사용법 소개 2

단순한 애니메이션

News/Events 2007. 10. 16. 18:12
arduino를 활용한 간단한 애니메이션

사용자 삽입 이미지

코드는 아래와 같으며, 기본적으로 3개의 이미지 파일을 연속해서 보여주는 코드이다.


//****************************//
//**********************************//
//  Name    : shiftOutCode, Hello World                         //
//  Author  : Carlyn Maw,Tom Igoe                               //
//  Date    : 25 Oct, 2006                                      //
//  Version : 1.0                                               //
//  Notes   : Code for using a 74HC595 Shift Register           //
//          : to count from 0 to 255                            //
//****************************************************************

//Pin connected to ST_CP of 74HC595
int latchPin = 7;
//Pin connected to SH_CP of 74HC595
int clockPin = 6;
////Pin connected to DS of 74HC595
int dataPin = 5;

      
int numSymbols = 3;              
int icon[] = {
  B11111111,   // I
  B11111111,
  B00011000,
  B00011000,
  B00011000,
  B00011000,
  B11111111,
  B11111111,       
  B00111100,  // Love
  B11111111,
  B11111111,
  B01111110,
  B00111100,
  B00011000,
  B00011000,
  B00000000,
  B11000011,  // U
  B11000011,
  B11000011,
  B11000011,
  B11000011,
  B11000011,
  B01100110,
  B00111100 
};

              
// FUNCTIONS


void anim2() {
  for (int j = 0; j < numSymbols; j++) {
     digitalWrite(latchPin, LOW);
     shiftOut(dataPin, clockPin, MSBFIRST, icon[7+8*j]);    
     shiftOut(dataPin, clockPin, MSBFIRST, icon[6+8*j]);    
     shiftOut(dataPin, clockPin, MSBFIRST, icon[5+8*j]);    
     shiftOut(dataPin, clockPin, MSBFIRST, icon[4+8*j]);    
     shiftOut(dataPin, clockPin, MSBFIRST, icon[3+8*j]);
     shiftOut(dataPin, clockPin, MSBFIRST, icon[2+8*j]);
     shiftOut(dataPin, clockPin, MSBFIRST, icon[1+8*j]);    
     shiftOut(dataPin, clockPin, MSBFIRST, icon[8*j]);
     digitalWrite(latchPin, HIGH);
     delay(1300);

 
     Serial.println(icon[2+8*j], BIN);
     Serial.println(icon[1+8*j], BIN);
     Serial.println(icon[8*j], BIN);
    

     Serial.println("**********");
  }
}



// END FUNCTIONS

void setup() {
 //set pins to output because they are addressed in the main loop
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
 Serial.begin(9600);
}

void loop() {
 anim2();
 delay(500);
}


작동되면 다음과 같다.



:

아두이노 보드 지그비 확장 보드 사용법

News/Events 2007. 10. 16. 15:10
아누이노 지그비 보드는 지그비 통신을 사용가능하게 하는 보드이기도 하지만, 아두이노 초보 사용자에게 맞게 여러 가지 확장 기능을 제공하고 있다. 사디 인터랙션 디자인 랩에서 가장 아끼는 보드 디자인이다.

우선 아날로그 인풋을 쉽게 할 수 있도록 그룹핑시켜 놓았다.

사용자 삽입 이미지


예를 들어 가변저항과 같은 경우,

사용자 삽입 이미지

위 그림처럼 쉽게 사용할 수 있게 되어있다.

빛 센서나 열센서의 경우에는 다음과 같이 사용할 수 있게 되어있다.

사용자 삽입 이미지
< 빛 센서의 경우 0 볼트와 아나로그 인풋 포트만 사용하면 된다. >

사용자 삽입 이미지

< 열 감지 센서의 경우도 마찬가지로 0 V 와 아나로그 인풋 포트만 사용하면 된다. >

아나로그 인풋 프로그램은 일반적으로 아래와 같이 테스트해볼 수 있다.

/*
 * AnalogInput
 * by DojoDave <http://www.0j0.org>
 *
 * Turns on and off a light emitting diode(LED) connected to digital 
 * pin 13. The amount of time the LED will be on and off depends on
 * the value obtained by analogRead(). In the easiest case we connect
 * a potentiometer to analog pin 2.
 *
 * http://www.arduino.cc/en/Tutorial/AnalogInput
 */

int potPin = 5;    // select the input pin for the potentiometer
int ledPin = 13;   // select the pin for the LED
int val = 0;       // variable to store the value coming from the sensor

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
  Serial.begin(9600);
}

void loop() {
  val = analogRead(potPin);    // read the value from the sensor
  digitalWrite(ledPin, HIGH);  // turn the ledPin on
  delay(val);                  // stop the program for some time
  digitalWrite(ledPin, LOW);   // turn the ledPin off
  delay(val);                  // stop the program for some time
  Serial.println(val, DEC);
}


:

32개의 아웃풋을 지원하는 보드 사용법 소개

News/Events 2007. 10. 16. 14:17

아두이노 보드를 사용하여 32개 혹은 64개의 아웃풋을 제어할 수 있는 확장보드로, 연결방법은 다음과 같습니다.

사용자 삽입 이미지

일단 아누이노의 3개의 핀으로 제어가 가능한 형태로 제작되었고, 샘플 프로그램은 아래와 같다.

//****************************
**********************************//
//  Name    : shiftOutCode, Hello World                         //
//  Author  : Carlyn Maw,Tom Igoe                               //
//  Date    : 25 Oct, 2006                                      //
//  Version : 1.0                                               //
//  Notes   : Code for using a 74HC595 Shift Register           //
//          : to count from 0 to 255                            //
//****************************************************************

//Pin connected to ST_CP of 74HC595
int latchPin = 10;
//Pin connected to SH_CP of 74HC595
int clockPin = 9;
////Pin connected to DS of 74HC595
int dataPin = 8;

//variable to store the first byte of data
int light0_7 = 0;
int light8_15 = 0;

// FUNCTIONS

void pinON(int pinNumber) {
 if (pinNumber <= 8)
   light0_7 |= 1<<(pinNumber-1);
 else
   light8_15 |= 1<<(pinNumber-9);
 digitalWrite(latchPin, LOW);
 shiftOut(dataPin, clockPin, MSBFIRST, light8_15);
 shiftOut(dataPin, clockPin, MSBFIRST, light0_7);
 digitalWrite(latchPin, HIGH);
}

void pinOFF(int pinNumber) {
 if (pinNumber <= 8)
 light0_7 &= ~(1<<(pinNumber-1));
 else
 light8_15 &= ~(1<<(pinNumber-9));
 digitalWrite(latchPin, LOW);
 shiftOut(dataPin, clockPin, MSBFIRST, light8_15);
 shiftOut(dataPin, clockPin, MSBFIRST, light0_7);
 digitalWrite(latchPin, HIGH);
}

// END FUNCTIONS

void setup() {
 //set pins to output because they are addressed in the main loop
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
 pinON(5);
 pinON(8);
}

void loop() {
 pinON(3);
 delay(1000);
 pinOFF(3);
 delay(1000);
}

위 프로그램이 하는 일은 5번 핀과 8번 핀은 항상 켜둔채, 3번 핀을 깜박거리게 하는 프로그램이다.

아두이노 확장 보드와 연결하면 다음과 같은 모습이다.

사용자 삽입 이미지



: