On Cloud!
We can't see the sound. It is human nature to want to see things that cannot be seen. We wanted to take advantage of this to create an exhibition content that would allow us to see waves of sound that we could not see. There are also several measures to maximize the fun factor.
소리는 볼 수 없다. 볼수 없는 것을 보고자하는 것이 인간의 본성이다. 우리는 이러한 점을 이용하여 볼 수 없는 소리의 파동을 볼 수 있는 컨텐츠로 바꾸어 만들고자 하였다. 또한 재미적요소를 극대화하기 위해 몇가지 방안을 추가하였다.
Intro
Drive Description Image
Introduction to the Structure - Top View
It's the floor plan of "On Cloud." the microphone portion that detects sound, the control box that controls the performance of the bulb, and controls the power supply, The bulb portion that implements the light performance, consisting of the frame part that supports these parts.
‘온클라우드’의 평면도이다. 소리를 감지하는 마이크 부분, 전구의 퍼포먼스를 제어하고, 전원을 조작할 수 있는 컨트롤 박스, 빛 퍼포먼스를 구현하는 전구 부분, 이 부분들을 지탱하는 프레임 부분으로 구성되어 있다.
Section Description
'On Cloud' consists of six main parts. Among them, the key is to control each bulb. The part is designed to be easily manipulated a large amount of light bulbs at the same time, organically. Through this part, Aduino recognizes each light bulb as a Neo-Pixel.Thanks to this part, a designer can effectively coding large quantities of light bulbs. Also, the connection between the light bulb and the light bulb is flexible. So It helps the designer can modify and supplement the number and form of the light bulb at any time. If you take advantage of these characteristics, you have access to many interesting lights design using light bulbs more easily.
‘온클라우드’는 크게 여섯가지의 파트로 이루어져 있다. 그 중에서 핵심은 각각의 전구를 컨트롤하는 부분이다. 다량의 전구를 동시에, 유기적으로, 쉽게 조작하기 위해 고안한 부분이다. 이 부분을 통해 아두이노는 각각의 전구를 네오픽셀처럼 인식해 디 자이너는 다량의 전구를 효과적으로 코딩할 수 있다. 또한 전구와 전구사이의 연결이 유동적인 연결부는 디자이너가 전구의 개 수, 형태 등을 언제든지 수정, 보완할 수 있게 도와준다. 이같은 특징을 잘 활용한다면, 전구를 이용한 다양하고 재밌는 빛 디자 인을 조금 더 쉽게 접근할 수 있을 것 이다.
Section Description - 파트별 상세 설명
- sensing part
- control box
- frame
- performance part
- each bulb
'On Cloud' consists of six main parts. Among them, the key is to control each bulb. The part is designed to be easily manipulated a large amount of light bulbs at the same time, organically. Through this part, Aduino recognizes each light bulb as a Neo-Pixel.Thanks to this part, a designer can effectively coding large quantities of light bulbs. Also, the connection between the light bulb and the light bulb is flexible. So It helps the designer can modify and supplement the number and form of the light bulb at any time. If you take advantage of these characteristics, you have access to many interesting lights design using light bulbs more easily.
‘온클라우드’는 크게 여섯가지의 파트로 이루어져 있다. 그 중에서 핵심은 각각의 전구를 컨트롤하는 부분이다. 다량의 전구를 동시에, 유기적으로, 쉽게 조작하기 위해 고안한 부분이다. 이 부분을 통해 아두이노는 각각의 전구를 네오픽셀처럼 인식해 디 자이너는 다량의 전구를 효과적으로 코딩할 수 있다. 또한 전구와 전구사이의 연결이 유동적인 연결부는 디자이너가 전구의 개 수, 형태 등을 언제든지 수정, 보완할 수 있게 도와준다. 이같은 특징을 잘 활용한다면, 전구를 이용한 다양하고 재밌는 빛 디자 인을 조금 더 쉽게 접근할 수 있을 것 이다.
The microphone is divided into sensors and led..
led receives electricity from Arduino and lights up the body of the microphone. The sensors are attached to each microphone, and a total of three are used in our hardware. We sometimes had the gauge bar in the making process that didn't work, and we tested the microphone sensors to make sure they worked well and corrected the error section. Initially, the maximum size of all microphone sensors was set to 0, the minimum size initial value was set to 1024. In addition, each microphone sensor was connected to an analog signal, A0, A1, A2, and measured the maximum and minimum values of sound so that the difference was recognized as the amplitude value (peakToPeak), indicating a number between 0 and 10. This result was checked by a serial monitor and picked out the faulty microphone sensor
<마이크 3개 구동 여부 테스트>
int value,value2,value3;
int num,num2,num3; int sampleWindow =50;
int M_const_Max =500;
int M_const_Min =150;
void setup() {
Serial.begin(9600);
}
void loop() {
unsigned long startMillis = millis();
unsigned int peakToPeak = 0;
unsigned int signalMax = 0;
unsigned int signalMin = 1024;
unsigned int peakToPeak2 = 0;
unsigned int signalMax2 = 0;
unsigned int signalMin2 = 1024;
unsigned int peakToPeak3 = 0;
unsigned int signalMax3 = 0;
unsigned int signalMin3 = 1024;
while (millis() - startMillis < sampleWindow) {
value = analogRead(A0);
if (value < 1024) {
if (value > signalMax) signalMax = value;
else if (value < signalMin) signalMin = value;
}
value2 = analogRead(A1);
if (value2 < 1024) { if (value2 > signalMax2) signalMax2 = value2;
else if (value2 < signalMin2) signalMin2 = value2;
}
value3 = analogRead(A2);
if (value3 < 1024) { if (value3 > signalMax3) signalMax3 = value3;
else if (value3 < signalMin3) signalMin3 = value3;
}
}
peakToPeak = signalMax - signalMin;
double volts = (peakToPeak * 5.0) / 1024;
peakToPeak = constrain(peakToPeak, M_const_Min, M_const_Max);
num = int(map(peakToPeak, M_const_Min, M_const_Max, 0, 10));
peakToPeak2 = signalMax2 - signalMin2;
double volts2 = (peakToPeak2 * 5.0) / 1024;
peakToPeak2 = constrain(peakToPeak2, M_const_Min, M_const_Max);
num2 = int(map(peakToPeak2, M_const_Min, M_const_Max, 0, 10));
peakToPeak3 = signalMax3 - signalMin3;
double volts3 = (peakToPeak3 * 5.0) / 1024;
peakToPeak3 = constrain(peakToPeak3, M_const_Min, M_const_Max);
num3 = int(map(peakToPeak3, M_const_Min, M_const_Max, 0, 10));
Serial.print("Center Mic");
Serial.print(" : ");
Serial.print(num);
Serial.print("R Mic");
Serial.print(" : ");
Serial.print(num2);
Serial.print("L Mic");
Serial.print(" : ");
Serial.println(num3);
//Serial.println(peakToPeak2);
//Serial.println(peakToPeak3);
}
The gauge bar made the bulb turn on based on the sound measured from the microphone sensor. The louder the sound, the more light bulbs were turned on in turn, making animation work when all the gauge bars are turned on. The next coding is a coding that can check these three things (mechanical sensor sound measurement, operation of gauge bar depending on volume, and link between gauge bar and animation). We experimented with a prototype with 14 light bulbs. This coding also allows you to pick out non-functioning light bulbs.
마이크 3개와 게이지바 작동 여부
그리고 애니메이션까지 이어지는지
#include
#define PIN 12
#define PIXEL_NUM 14
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_NUM, PIN, NEO_GRB + NEO_KHZ800);
int iteration = 3;
const int sampleWindow = 50; // 샘플링한 시간 50ms
unsigned int value; // 소리 증폭 감지 센서 값 받는 변수
int num; float test; float interval;
float interval_decrease =0.9;
void setup() {
strip.begin();
alloff();
Serial.begin(9600); // 시리얼 모니터 시작, 속도는 9600 }
void loop() { alloff();
///////////////////////////////////////////////////////////////////////////////
//데시벨 센싱
// 50ms 동안의 음량(데시벨)을 계산하기위한 가장 높은 수치(signalMax)와 가장 낮은 수치값(signalMin)을 결정
unsigned long startMillis = millis(); // 샘플링 시작
unsigned int peakToPeak = 0; // 음성 신호의 진폭
unsigned int signalMax = 0; // 최대 크기를 초기에는 0으로 설정
unsigned int signalMin = 1024; // 최소 크기를 초기에는 1024로 설정
while (millis() - startMillis < sampleWindow) { // 데이터를 50ms마다 모으는 while문
value = analogRead(A0); // 소리 감지센서에더 데이터 받아오기
if (value < 1024) { // 받아온 데이터의 값이 1024 이하일 때
if (value > signalMax) // 최대 크기 측정
signalMax = value; // 최대 크기 signalMax에 저장
else if (value < signalMin) // 최소 크기 측정
signalMin = value; // 최소 크기 sigmalMin에 저장
}
}
peakToPeak = signalMax - signalMin; // 최대- 최소 = 진폭값
peakToPeak = constrain(peakToPeak, 150, 500);
// 측정된 음량에 따른 켜질 전구의 수 결정
num = int(map(peakToPeak, 150, 500, 0, PIXEL_NUM));
//////////////////////////////////////////////////////////////////////////////////
//소리측정 전구가 다 켜졌을 때 작동하는 애니메이션 예시
for (int i = 0; i < PIXEL_NUM; i++) {
if (i < num) strip.setPixelColor(i, 255, 255, 0);
else strip.setPixelColor(i, 255, 255, 255);
}
strip.show();
if (num == PIXEL_NUM) {
animation();
}
}
void alloff() {
for (int i = 0; i < PIXEL_NUM; i++) {
strip.setPixelColor(i, 255, 255, 255);
}
}
void animation() {
interval =5;
for (int count = 0; count < iteration; count++) {
for (int bri = 0; bri < 501; bri++) {
for (int i = 0; i < PIXEL_NUM; i++) {
test = 0.5+0.5 * sin((bri * (TWO_PI / 500)) + PI / 2);
strip.setPixelColor(i, 255, 255, 255*test); } delay(interval); strip.show();
}
interval = interval*interval_decrease;
}
}
Section Description(1)-Sensing Part
Section Description(2)-Gauge Bar & Performance Part
Process
Light Design
The process of designing light with multiple bulbs consists of three stages. Light design can be implemented through the process of ideation, the process of sketching an animation, and the process of programming it. We conceived the idea under the theme of "The Moment to Feel Beauty through Light." We have developed four concepts as a result of 100 ideas and experiments on when people can feel aesthetic satisfaction with light. If the composition of the board is right, more and more diverse ideas could be implemented in the same way as Neo-Pixel.
다수의 전구로 빛을 디자인하는 과정은 세 단계로 이루어진다. 아이데이션 하는 과정, 애니메이션을 스케치하는 과정, 이를 프로그래밍하는 과정으로 빛 디자인을 구현할 수 있다. 우리는 ‘빛을 통해 아름다움을 느끼는 순간’을 주제로 아이디어를 구 상했다. 사람들이 언제 빛으로 심미적인 충족감을 느낄 수 있을 지에 대하여 100여가지의 소재를 아이데이션,실험해 보았 으며, 그 결과 4가지의 컨셉을 개발하게 되었다. 보드의 구성이 알맞게 되어 있다면, 더욱 더 다양한 아이디어를 네오픽셀 과 동일한 방식으로 구현할 수 있을 것이다.
Light Design1 - Night View of the City
He expressed the night vision of the irregularly sparkling city. The animation, which shows no constant light speed, brightness, location, or anything, intrigues users with its irregularity.
불규칙하게 반짝이는 도시의 야경 불빛을 표현했다. 빛의 속도, 밝기, 위치 그 어느것도 일정하게 나타나지 않는 이 애니메이 션은 어수선하면서도 통일감을 안겨줘 이용자들에게 흥미를 불러일으킨다.
Light Design2 - Breath of Light
It is an animation where light bulbs, not life, breathe like life. As the light gradually turns on and off, it reminds us of a forest that is seemingly still but in fact still alive.
생명체가 아닌 전구들이 마치 생명체처럼 숨을 쉬는 듯한 애니메이션이다. 빛이 점점 켜졌다 꺼지면서 마치 겉으로 보기에는 고요하지만 사실은 살아 숨쉬고 있는 숲을 연상시킨다.
Light Design3 - Firefly
이 애니메이션은 자연의 대표적인 빛의 움직임 중 하나인 반딧불이를 모티브로 하였다. 빛의 속도가 개별적으로 달라 예측하기 어렵고 그 불규칙성 안에서 사람들의 흥미를 끌기 위하여 제작하였다.
The animation is based on fireflies, one of nature's most representative light movements. It is difficult to predict individually different light speeds and is designed to attract people's attention within its irregularity.
Light Design4 - Equalizer
소리 표현의 대표적인 예시인 이퀄라이저를 모티브로 소리의 파동에 따라 빛이 점차 쌓이고 사라짐.이 애니메이션을 통하여 사람들이 자연스럽게 소리를 눈으로 볼 수 있고 재미를 느낄 수 있도록 제작하였다.
Light accumulates and disappears gradually according to the wave of sound through the motif of equalizer, a representative example of sound expression. We made this animation so that people can see the sounds with their eyes and have fun.
Let's Code
<p><초기값 설정><br> #include #define PIN1 6 //1st sound gauge #define PIN2 9 //2nd sound gauge #define PIN3 10 //3rd sound gauge #define PIN4 11 // Animation #define A 0 #define B 1 #define C 2 #define D 3 #define M 13 #define E 4 #define F 5 #define G 6 #define H 7 #define I 8 #define J 9 #define K 10 #define L 11 #define N 12 #define P 255 #define CENTER 35 #define SOUND 5 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(SOUND, PIN1, NEO_GRB + NEO_KHZ800); //*네오픽셀 나오는 구간 설정*// Adafruit_NeoPixel pixels2 = Adafruit_NeoPixel(SOUND, PIN2, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels3 = Adafruit_NeoPixel(SOUND, PIN3, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels4 = Adafruit_NeoPixel(CENTER, PIN4, NEO_GRB + NEO_KHZ800); // set num of light #define PIXEL_NUM 11 // set num of pin(neo pixel) // if using product on development, under value 'PROTOTYPE' is '0' #define BRIGHT_TIMER 150 #define PROTOTYPE 1 //*프로토타입으로 테스트해볼경우 쓰는 코딩 (시작)*// #if PROTOTYPE #define BRIGHTNESS 255 #define PRODUCT 1.0 #define SUM 0 #define ON 0 #define OFF 255 #define PP 1 #else #define PIN 11 #define BRIGHTNESS 20 #define PRODUCT -1.0 #define SUM -255 #define ON 255 #define OFF 0 #define PP 244 #endif //*프로토타입으로 테스트해볼경우 쓰는 코딩(끝)*// int i; int a, b; int speed_m = 20; int ledVal; int iteration = 2; int count = 0; int num, num2, num3; int arrspeed[] = {11, 5, 8, 11, 5, 8, 11, 5, 8, 11, 5, 8, 11, 5}; int arrpin[] = {2, 5, 8, 11, 13, 1, 7, 3, 9, 4, 6, 14, 10, 12 }; int sound_value ; int pins[] = {0, 1, 2, 3, 4}; int pins2[] = {0, 1, 2, 3, 4}; int pins3[] = {0, 1, 2, 3, 4}; int pinNums = 10; int pinNums2 = 5; int pinNums3 = 5; int sequence = 0 ; uint8_t mode = 0, offset = 0; uint32_t color = 0x00ffae; uint32_t prevTime; uint32_t on_timer_sound = millis(); uint32_t set_timer_sound2 = millis(); float sinVal; const int sampleWindow = 50; const int sampleWindow2 = 50; const int sampleWindow3 = 50; unsigned int value, value2, value3; boolean sensing = true; </p><p>class animation { private: uint32_t on_timer = millis(); bool on_timer_cnt = 0; float something = 0; double value_last = 0; double value_fast; bool temp_cnt = 0; int count = 0; public: double SINE_DATA(int pin); void STOP(int pin); void RESET(); }; void animation::RESET() { on_timer = millis(); on_timer_cnt = 0; something = 0; value_last = 0; value_fast; temp_cnt = 0; count = 0; } double animation::SINE_DATA(int pin) { if (on_timer_cnt == 0) { on_timer = millis(); on_timer_cnt = 1; // Serial.println(on_timer); } // value_fast = -1.0 * (127.0 + 128 * cos( (millis() - on_timer ) / 5000.0 * speed_m * PI ) - 255); //testing code // value_fast = (128.0 + 128 * cos( (millis() - on_timer ) / 5000.0 * speed_m * PI )); //prototype code value_fast = PRODUCT * (127.0 + 128 * cos( (millis() - on_timer ) / 5000.0 * speed_m * PI ) + SUM); if ((int)value_fast > 2 and (int)value_last <= 2 ) { if (temp_cnt == 1) { count += 1 ; } } if (count < 3) { pixels4.setPixelColor(pin, (int)value_fast, (int)value_fast, (int)value_fast); } if (temp_cnt == 0) { temp_cnt = 1; } value_last = value_fast; if (count >= 3) { pixels4.setPixelColor(pin, OFF, OFF, OFF); // on_timer = millis(); // count = 0; return 0; } else { return value_fast; } } void animation::STOP(int pin) { pixels4.setPixelColor(pin, OFF, OFF, OFF); } animation pixel_1; animation pixel_2; animation pixel_3; animation pixel_4; animation pixel_5; animation pixel_6; animation pixel_7; animation pixel_8; animation pixel_9; animation pixel_10; animation pixel_11; animation pixel_12; animation pixel_13; animation pixel_14; animation pixel_15; animation pixel_16; animation pixel_17; animation pixel_18; animation pixel_19; animation pixel_20; animation pixel_21; animation pixel_22; animation pixel_23; animation pixel_24; animation pixel_25; animation pixel_26; animation pixel_27; animation pixel_28; animation pixel_29; animation pixel_30; animation pixel_31; animation pixel_32; animation pixel_33; animation pixel_34; animation pixel_35; void setup() { randomSeed(analogRead(0)); pinMode(A0, INPUT); pinMode(A1, INPUT); pinMode(A2, INPUT); <밝기 설정> pixels.setBrightness(255); pixels2.setBrightness(255); pixels3.setBrightness(255); pixels4.setBrightness(255); <네오픽셀 1,2,3,4 초기설정> pixels.begin(); for (int i = 0; i < SOUND; i++) { pixels.setPixelColor(i, 255, 255, 255); } pixels.show(); pixels2.begin(); for (int i = 0; i < SOUND; i++) { pixels2.setPixelColor(i, 255, 255, 255); } pixels2.show(); pixels3.begin(); for (int i = 0; i < SOUND; i++) { pixels3.setPixelColor(i, 255, 255, 255); } pixels3.show(); pixels4.begin(); for (int i = 0; i < CENTER; i++) { pixels4.setPixelColor(i, 255, 255, 255); } pixels4.show(); Start(); // for (int i = 0; i < pinNums; i++) { // pinMode(pins[i], OUTPUT); // } // // for (int j = 0; j < pinNums2; j++) { // pinMode(pins2[j], OUTPUT); // } // // for (int k = 0; k < pinNums3; k++) { // pinMode(pins3[k], OUTPUT); // } Serial.begin(9600); //class animation { // private: // uint32_t on_timer = millis(); // bool on_timer_cnt = 0; // float something = 0; // double value_last = 0; // double value_fast; // bool temp_cnt = 0; // int count = 0; // // public: // double SINE_DATA(int pin); // void STOP(int pin); //}; // //void animation::RESET() { // on_timer = millis(); // on_timer_cnt = 0; // something = 0; // value_last = 0; // value_fast; // temp_cnt = 0; // count = 0; //} // //double animation::SINE_DATA(int pin) { // // if (on_timer_cnt == 0) { // on_timer = millis(); // on_timer_cnt = 1; // // Serial.println(on_timer); // // } // // // // value_fast = -1.0 * (127.0 + 128 * cos( (millis() - on_timer ) / 5000.0 * speed_m * PI ) - 255); //testing code // // value_fast = (128.0 + 128 * cos( (millis() - on_timer ) / 5000.0 * speed_m * PI )); //prototype code // value_fast = PRODUCT * (127.0 + 128 * cos( (millis() - on_timer ) / 5000.0 * speed_m * PI ) + SUM); // if ((int)value_fast > 2 and (int)value_last <= 2 ) { // if (temp_cnt == 1) { // count += 1 ; // } // } // if (count < 3) { // pixels4.setPixelColor(pin, (int)value_fast, (int)value_fast, (int)value_fast); // } // if (temp_cnt == 0) { // temp_cnt = 1; // } // value_last = value_fast; // if (count >= 3) { // pixels4.setPixelColor(pin, OFF, OFF, OFF); // // on_timer = millis(); // // count = 0; // return 0; // } // else { // return value_fast; // } //} // //void animation::STOP(int pin) { // pixels4.setPixelColor(pin, OFF, OFF, OFF); //} } <사운드센서 설정 부분 시작> void loop() { unsigned long startMillis = millis(); unsigned int peakToPeak = 0; unsigned int signalMax = 0; unsigned int signalMin = 1024; unsigned int peakToPeak2 = 0; unsigned int signalMax2 = 0; unsigned int signalMin2 = 1024; unsigned int peakToPeak3 = 0; unsigned int signalMax3 = 0; unsigned int signalMin3 = 1024; while (millis() - startMillis < sampleWindow) { value = analogRead(A0); if (value < 1024) { if (value > signalMax) signalMax = value; else if (value < signalMin) signalMin = value; } value2 = analogRead(A1); if (value2 < 1024) { if (value2 > signalMax2) signalMax2 = value2; else if (value2 < signalMin2) signalMin2 = value2; } value3 = analogRead(A2); if (value3 < 1024) { if (value3 > signalMax3) signalMax3 = value3; else if (value3 < signalMin3) signalMin3 = value3; } } peakToPeak = signalMax - signalMin; double volts = (peakToPeak * 5.0) / 1024; peakToPeak = constrain(peakToPeak, 300, 500); num = int(map(peakToPeak, 300, 500, 0, SOUND)); peakToPeak2 = signalMax2 - signalMin2; double volts2 = (peakToPeak2 * 5.0) / 1024; peakToPeak2 = constrain(peakToPeak2, 300, 500); num2 = int(map(peakToPeak2, 300, 500, 0, SOUND)); peakToPeak3 = signalMax3 - signalMin3; double volts3 = (peakToPeak3 * 5.0) / 1024; peakToPeak3 = constrain(peakToPeak3, 300, 500); num3 = int(map(peakToPeak3, 300, 500, 0, SOUND)); //*사운드센서 설정 부분 끝*// <사운드센서에 따른 네오픽셀 동작 시작> for (int i = 0; i < SOUND; i++) { if (i < num) { pixels.setPixelColor(pins[i], 0, 0, 0); pixels.show(); } else { pixels.setPixelColor(pins[i], 255, 255, 255); pixels.show(); } } for (int j = 0; j < SOUND; j++) { if (j < num2) { pixels2.setPixelColor(pins[j], 0, 0, 0); pixels2.show(); } else { pixels2.setPixelColor(pins[j], 255, 255, 255); pixels2.show(); } } for (int k = 0; k < SOUND; k++) { if (k < num3) { pixels3.setPixelColor(pins[k], 0, 0, 0); pixels3.show(); } else { pixels3.setPixelColor(pins[k], 255, 255, 255); pixels3.show(); } } //*사운드센서에 따른 네오픽셀 동작 끝*// <사운드센서 값에 따른 각 시퀸스 발동 시작 > Serial.print(num); Serial.print("/"); Serial.print(num2); Serial.print("/"); Serial.println(num3); delay(50); if (num == 5) { num = 100; } if (num2 == 5) { num2 = 100; } if (num3 == 5) { num3 = 100; } int sum = num + num2 + num3; if (millis() - on_timer_sound < 1000000000000000000000) { <1번시퀸스일경우 (시작)> uint32_t set_timer_sound1 = millis(); if (sum <128 & sum >99) { Serial.println(sequence); if (millis() - set_timer_sound1 < 10000) { sequence1(); sequence = 1; } } if (sequence == 1) { if (millis() - set_timer_sound2 > 10000) { sequence = 0; sequenceOFF(); set_timer_sound2 = millis(); delay(500); } } //*1번시퀸스일경우 (끝)*// <1번시퀸스일경우 (시작)> uint32_t set_timer_sound1 = millis(); if (sum <128 & sum >99) { Serial.println(sequence); if (millis() - set_timer_sound1 < 10000) { sequence1(); sequence = 1; } } if (sequence == 1) { if (millis() - set_timer_sound2 > 10000) { sequence = 0; sequenceOFF(); set_timer_sound2 = millis(); delay(500); } } //*1번시퀸스일경우 (끝)*// <3번시퀸스일경우 (시작)> if (sum == 300) { if (sequence == 0 || sequence == 1 || sequence == 2) { if (millis() - set_timer_sound1 < 10000) { sequence3(); sequence = 3; } } } if (millis() - set_timer_sound2 > 10000) { if (sequence == 3) { sequence = 0; sequenceOFF(); set_timer_sound2 = millis(); delay(500); } } } } //*3번시퀸스일경우 (끝)*// <각 시퀸스 함수 설정> void sequence1() { for (int i = 0; i < 5 ; i++) { pixels4.setPixelColor(i, 255, 0, 0); pixels4.show(); } } void sequence2() { for (int i = 0; i < 17 ; i++) { pixels4.setPixelColor(i, 255, 0, 0); pixels4.show(); } } void sequence3() { for (int i = 0; i < CENTER ; i++) { pixels4.setPixelColor(i, 255, 255, 255); pixels4.show(); } int ran = random(1, 5); if (ran == 1) { fire_start(); } else if (ran == 2) equil(); else if (ran == 3) twin(); else if (ran == 4) breath(); } void sequenceOFF() { for (int i = 0; i < CENTER ; i++) { pixels4.setPixelColor(i, 255, 255, 255); pixels4.show(); } } <처음시작할경우 차례대로 켜지는 부분> void Start() { char notes[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34}; int notesize = sizeof(notes) / sizeof(char); int a; for (int i = 0; i < notesize; i++) { a = notes[i]; pixels4.setPixelColor(a, 0, 0, 0); pixels4.show(); delay(200); } for (int i = 0; i < CENTER; i++) { pixels4.setPixelColor(i, 255, 255, 255); } pixels4.show(); } <애니메이션 4가지 및 정리> //*equil 애니메이션 *// void equil() { char notes[] = {1,9,12,22,0,23,21,10,11,2,13,7,20,8,3,18,6,14,15,19,4,16,5,17,1,9,12,22,0,23,21,10,11,2,13,7,20,8,3,18,6,14,15,19,4,16,5,17}; char color1[] = {A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P}; int notesize = sizeof(notes) / sizeof(char); int colorsize = sizeof(color1) / sizeof(char); int a, b; for (int j = 0; j < 2; j++) { for (int i = 0; i < notesize; i++) { a = notes[i]; b = color1[i]; pixels4.setPixelColor(a, b, b, b); pixels4.show(); delay(150); } for (int i = 0; i < CENTER; i++) { pixels4.setPixelColor(i, 255, 255, 255); } pixels4.show(); } } //*twin 애니메이션 *// void twin() { uint32_t timer_twin = millis(); Serial.println("Twin"); while (1) { if (millis() - timer_twin < 6500) { uint8_t i; uint32_t t; for (int count = 0; count < 2; count++) { for (i = 0; i < CENTER; i++) { uint32_t c = 0; if (((offset + i) & 42) < 2) c = color; // 4 pixels on... pixels4.setPixelColor( i, c); // First eye pixels4.setPixelColor((42) - i, c); // Second eye (flipped) // pixels.setPixelColor(i, 255, 255, 255); } pixels4.show(); offset++; delay(50); } // for (int j = 0; j < 256; j++ ) { for (int i = 0; i < CENTER; i++) { // pixels.setPixelColor(i, j, j, j); pixels4.setPixelColor(i, 255, 255, 255); } // delay(1); // } pixels4.show(); } else { for (int i = 0; i < CENTER; i++) { // pixels.setPixelColor(i, j, j, j); pixels4.setPixelColor(i, 0, 0, 0); pixels4.show(); } for (int j = 0; j < 255; j++ ) { for (int i = 0; i < CENTER; i++) { pixels4.setPixelColor(i, j, j, j); // pixels.setPixelColor(i, 255, 255, 255); } delay(10); pixels4.show(); } break; } } return; } //*breath 애니메이션 *// void breath() { float test; float interval; float interval_decrease = 0.9; interval = 5; for (int count = 0; count < iteration; count++) { for (int bri = 0; bri < 501; bri++) { for (int i = 0; i < CENTER; i++) { test = 0.5 + 0.5 * sin((bri * (TWO_PI / 500)) + PI / 2); pixels4.setPixelColor(i, 255 * test, 255 * test, 255 * test); } delay(interval); pixels4.show(); } interval = interval * interval_decrease; } for (int i = 0; i < CENTER; i++) { pixels4.setPixelColor(i, 255, 255, 255); } pixels4.show(); } void fire_start() { for (int i = 0; i < 2; i ++) { fire(speed_m, arrpin[i], arrpin[i + 1], arrpin[i + 2]); } } //*fire 애니메이션 *// void fire(int speed_m, int pin, int pin2 , int pin3) { uint32_t timer_temp = millis(); pixel_1.RESET(); pixel_2.RESET(); pixel_3.RESET(); pixel_4.RESET(); pixel_5.RESET(); pixel_6.RESET(); pixel_7.RESET(); pixel_8.RESET(); pixel_9.RESET(); pixel_10.RESET(); pixel_11.RESET(); pixel_12.RESET(); pixel_13.RESET(); pixel_14.RESET(); pixel_15.RESET(); pixel_16.RESET(); pixel_17.RESET(); pixel_18.RESET(); pixel_19.RESET(); pixel_20.RESET(); pixel_21.RESET(); pixel_22.RESET(); pixel_23.RESET(); pixel_24.RESET(); pixel_25.RESET(); pixel_26.RESET(); pixel_27.RESET(); pixel_28.RESET(); pixel_29.RESET(); pixel_30.RESET(); pixel_31.RESET(); pixel_32.RESET(); pixel_33.RESET(); pixel_34.RESET(); pixel_35.RESET(); while (1) { if (millis() - timer_temp > BRIGHT_TIMER) { pixel_1.SINE_DATA(0); } if (millis() - timer_temp > BRIGHT_TIMER * 2) { pixel_2.SINE_DATA(1); } if (millis() - timer_temp > BRIGHT_TIMER * 3) { pixel_3.SINE_DATA(2); } if (millis() - timer_temp > BRIGHT_TIMER * 4) { pixel_4.SINE_DATA(3); } if (millis() - timer_temp > BRIGHT_TIMER * 5) { pixel_5.SINE_DATA(4); } if (millis() - timer_temp > BRIGHT_TIMER * 6) { pixel_6.SINE_DATA(5); } if (millis() - timer_temp > BRIGHT_TIMER * 7) { pixel_7.SINE_DATA(6); } if (millis() - timer_temp > BRIGHT_TIMER * 8) { pixel_8.SINE_DATA(7); } if (millis() - timer_temp > BRIGHT_TIMER * 9) { pixel_9.SINE_DATA(8); } if (millis() - timer_temp > BRIGHT_TIMER * 10) { pixel_10.SINE_DATA(9); } if (millis() - timer_temp > BRIGHT_TIMER * 11) { pixel_11.SINE_DATA(10); } if (millis() - timer_temp > BRIGHT_TIMER * 12) { pixel_12.SINE_DATA(11); } if (millis() - timer_temp > BRIGHT_TIMER * 13) { pixel_13.SINE_DATA(12); } if (millis() - timer_temp > BRIGHT_TIMER * 14) { pixel_14.SINE_DATA(13); } if (millis() - timer_temp > BRIGHT_TIMER * 15) { pixel_15.SINE_DATA(14); } if (millis() - timer_temp > BRIGHT_TIMER * 16) { pixel_16.SINE_DATA(15); } if (millis() - timer_temp > BRIGHT_TIMER * 17) { pixel_17.SINE_DATA(16); } if (millis() - timer_temp > BRIGHT_TIMER * 18) { pixel_18.SINE_DATA(17); } if (millis() - timer_temp > BRIGHT_TIMER * 19) { pixel_19.SINE_DATA(18); } if (millis() - timer_temp > BRIGHT_TIMER * 20) { pixel_20.SINE_DATA(19); } if (millis() - timer_temp > BRIGHT_TIMER * 21) { pixel_21.SINE_DATA(20); } if (millis() - timer_temp > BRIGHT_TIMER * 22) { pixel_22.SINE_DATA(21); } if (millis() - timer_temp > BRIGHT_TIMER * 23) { pixel_23.SINE_DATA(22); } if (millis() - timer_temp > BRIGHT_TIMER * 24) { pixel_24.SINE_DATA(23); } if (millis() - timer_temp > BRIGHT_TIMER * 25) { pixel_25.SINE_DATA(24); } if (millis() - timer_temp > BRIGHT_TIMER * 26) { pixel_26.SINE_DATA(25); } if (millis() - timer_temp > BRIGHT_TIMER * 27) { pixel_27.SINE_DATA(26); } if (millis() - timer_temp > BRIGHT_TIMER * 28) { pixel_28.SINE_DATA(27); } if (millis() - timer_temp > BRIGHT_TIMER * 29) { pixel_29.SINE_DATA(28); } if (millis() - timer_temp > BRIGHT_TIMER * 30) { pixel_30.SINE_DATA(29); } if (millis() - timer_temp > BRIGHT_TIMER * 31) { pixel_31.SINE_DATA(30); } if (millis() - timer_temp > BRIGHT_TIMER * 32) { pixel_32.SINE_DATA(31); } if (millis() - timer_temp > BRIGHT_TIMER * 33) { pixel_33.SINE_DATA(32); } if (millis() - timer_temp > BRIGHT_TIMER * 34) { pixel_34.SINE_DATA(33); } if (millis() - timer_temp > BRIGHT_TIMER * 35) { pixel_35.SINE_DATA(34); break; } pixels4.show(); } ; }</p>