Microduino Butterfly Light
From Microduino Wiki
ContentsOutline
Team Introduction
| ||||||||||||||||||||||||||||||||||||
Bill of Material
DocumentProgram download: Butterfly_light 3D model download: File:3D-Butterfly light.zip Build 3D ModelThe model adopts buttery shape. Build Hardware Circuit
Prepare Audio
Software DebuggingProgram Description
int sensor_pin[7]=
{
4,8,10,12,A0,A2,A6
};
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(7, PIN, NEO_GRB + NEO_KHZ800);
for(int a=0;a<7;a++)
{
{
if(key_get(sensor_pin[a],1)) //When triggered,
{
//colorWipe(strip.Color(255, 255, 0), 10);
sensor_vol_cache[a]++; //Counting
// Serial.print("+");
if(sensor_vol_cache[a]>3)
sensor_vol_cache[a]=3;
{
colorWipe(color[8], a);
num=a;
audio_choose(a+1);
audio_play();
colorWipe(color[0], a);
}
time1[a]=millis();
}
if(millis()-time1[a]>500 && sensor_vol_cache[a]!=0) //Just start it and delay for one second or more, and the scan is ended.
{
if(sensor_vol_cache[a]==1)
{
colorWipe(color[0], a);
Serial.println("LED_OFF");
}
else if(sensor_vol_cache[a]==2)
{
colorWipe(color[8], a);
}
else
{
randomSeed(millis()%1000);
sensor_vol[a]=random(1,7);
Serial.println("");
Serial.print("num:");
Serial.print(a);
Serial.print(":");
Serial.print(sensor_vol[a]);
colorWipe(color[sensor_vol[a]], a);
}
sensor_vol_cache[a]=0; //Return to zero and wait for the next scan.
}
}
} Program Download
Overall Assembling
Notice
Video |