Sunday, April 29, 2012
Monday, April 23, 2012
Final Steps
1. Stain the wood until we recieve the desired color.
2. Place the hangers on the back of the table top so it can also function as an interactive wallpiece.
3. Paint the interior of our actual table (logo or brand for Alli and me)
4. Gather our items to place inside our table so we have "games" or activites to play on our table.
- Milar sheet with squares for chess or checkers
- Clear plates, cups, and silverware
- Basketball rim with net and foam ball for when the tabletop is hanging on the wall
- Deck of cards with poker chips
- Clear shot glasses (drinking games)
- Clear Dice
- Clear pieces for other games
2. Place the hangers on the back of the table top so it can also function as an interactive wallpiece.
3. Paint the interior of our actual table (logo or brand for Alli and me)
4. Gather our items to place inside our table so we have "games" or activites to play on our table.
- Milar sheet with squares for chess or checkers
- Clear plates, cups, and silverware
- Basketball rim with net and foam ball for when the tabletop is hanging on the wall
- Deck of cards with poker chips
- Clear shot glasses (drinking games)
- Clear Dice
- Clear pieces for other games
Response from Prior Professors
Alli and I set our table up so we could have some of our fellow students and professors admire and interact with our project we took there feedback. Professor Dick Davisson (left) made comments such as, "This is awesome. It looks perfect just the way it is." While showing a high school senior the Langford Building, Professor Terry Larsen was pleasantly pleased with what we had put together. Hearing positive feedback from our fellow students and professors definitely makes the hard work worth it. All smiles here!!! (:
Finished Table (Without Stain)
The next step for Alli and I to finish our table is staining it to the color desired. We purchased a Red Mahogany color to accent the blue LEDs fom our interactive panels. Once you lift the table top off there is an inset in which we have all our "games" to play on top of our table.
Sunday, April 22, 2012
Table Building Progress
What is left on the table design:
Sand till we get the desired smoothness
Stain the outside for desired color at least 2 times
Place hangers on the back of the table-top so it can double function as a wall piece
Paint the inside of actual table
Place LED Panels and Glass Piece into the incut
Wednesday, April 18, 2012
Progress Work
Yesterday in the mail our interactive LED parts came in and the assembly began from there.
Here is a photo of Alli soldering some parts to the back of our board so they'll stay in place.
Here is the board once we placed all the resistors, capacitors, and LEDs into it.
Here is a photo of the two 1 foot by 1 foot square panels that are combined in the middle to create our 1' by 2' rectangle of interactive funtime!
Here is a photo of Alli soldering some parts to the back of our board so they'll stay in place.
Here is the board once we placed all the resistors, capacitors, and LEDs into it.
Here is a photo of the two 1 foot by 1 foot square panels that are combined in the middle to create our 1' by 2' rectangle of interactive funtime!
Rough Sketches - Outline
This photo is of the rough sketch I composed to get measurements for cutting our table.
Wednesday, April 11, 2012
Final with Alli
Original Idea
Originally for our final Alli and I wanted to make a fully interactive wall that would light up with LEDs that respond to the users movement. Our idea began to change once we realized that we only had 3 weeks to finish. Price was also an issue on doing a project this big. With more time and a reasonable budget we would have went for it, but for now we sized down our project to try and make smaller interactive wall (maybe a coffee table).
Originally for our final Alli and I wanted to make a fully interactive wall that would light up with LEDs that respond to the users movement. Our idea began to change once we realized that we only had 3 weeks to finish. Price was also an issue on doing a project this big. With more time and a reasonable budget we would have went for it, but for now we sized down our project to try and make smaller interactive wall (maybe a coffee table).
New Concept
Once we made the decision to size down our project we started thinking about building an interactve coffee table or something of the sort. We not only want the user to be able to make the LEDs come on through motion but also have objects trigger the lights depending on the distance away from the lights.
Inspirational Sites
Inspirational Videos
<iframe width="560" height="315"
src="http://www.youtube.com/embed/GHLu9pxCKz8"
frameborder="0" allowfullscreen></iframe>
<iframe width="560" height="315"
src="http://www.youtube.com/embed/4VDfZ7RFjfE"
frameborder="0" allowfullscreen></iframe>
<iframe width="420" height="315"
src="http://www.youtube.com/embed/0XVWjLKlSWg"
frameborder="0" allowfullscreen></iframe>
Tuesday, April 3, 2012
1st, 2nd, & 3rd Person Analysis + Future Plans
1st Person Analysis
Upon wearing the tie, i felt confident in the design being aesthetically pleasing. The tie can easily stand by itself as a new fashion even without the music or LED light. While wearing the tie I felt as if I was the center of attention and the "life of the party." Functionally, you have to be gentle with the buttons while pressing them. Also, the weight of the tie is kind of surprising when it is on your neck. The tie was easily the most dynamic part of my outfit though and I would love to wear it around people who have no clue what it does yet.
2nd Person Analysis
When Matt and I let others wear out tie and test it out the overall attitude was very positive and pleasing. We had people asking to wear it and try it. Others wanted to press the buttons when they weren't wearing the tie. "I feel like I could be a musician now," said Brett Baxter after wearing the finished tie and playing around with it. Negative feedback consisted of people stating that the buttons were very sensitive to touch and the fact that you couldn't have two keys playing simultaneously.
3rd Person Analysis
The functionallity of the tie works beautifully and the design is aesthetically pleasing from across the room. While looking at the tie on other people, my eye tended to be drawn toward the LED light more than the actual tie itself. The music that is issued from the press of a button could be louder. However, the work put into the tie is all worth it when you see your friends' faces light up with excitement from your creation.
Future Plans
If I was to continue this project I would definitely either take the LED completely out (because it almost distracts from the tie itself) or add more LEDs to level out the balance of light. Also, I would find a way to make the buzzer that issued the sound louder. It would be nice to have a primary sound play on a button hit, with a secondary melody accenting the original sound in the background. Overall though, I'd say it was a very successful project.
Upon wearing the tie, i felt confident in the design being aesthetically pleasing. The tie can easily stand by itself as a new fashion even without the music or LED light. While wearing the tie I felt as if I was the center of attention and the "life of the party." Functionally, you have to be gentle with the buttons while pressing them. Also, the weight of the tie is kind of surprising when it is on your neck. The tie was easily the most dynamic part of my outfit though and I would love to wear it around people who have no clue what it does yet.
2nd Person Analysis
When Matt and I let others wear out tie and test it out the overall attitude was very positive and pleasing. We had people asking to wear it and try it. Others wanted to press the buttons when they weren't wearing the tie. "I feel like I could be a musician now," said Brett Baxter after wearing the finished tie and playing around with it. Negative feedback consisted of people stating that the buttons were very sensitive to touch and the fact that you couldn't have two keys playing simultaneously.
3rd Person Analysis
The functionallity of the tie works beautifully and the design is aesthetically pleasing from across the room. While looking at the tie on other people, my eye tended to be drawn toward the LED light more than the actual tie itself. The music that is issued from the press of a button could be louder. However, the work put into the tie is all worth it when you see your friends' faces light up with excitement from your creation.
Future Plans
If I was to continue this project I would definitely either take the LED completely out (because it almost distracts from the tie itself) or add more LEDs to level out the balance of light. Also, I would find a way to make the buzzer that issued the sound louder. It would be nice to have a primary sound play on a button hit, with a secondary melody accenting the original sound in the background. Overall though, I'd say it was a very successful project.
Monday, April 2, 2012
Final Tie Video
Our tie consists of 6 buttons running from the bottom-up; and when you hit one of them a connection is caused by two conductive pieces of fabric hittin eachother and sending a current through a conductive string that runs up to our arduino board, which then makes the code initiate. In our case is playing a short tune and lighting a different color on the LED.
Arduino Code for Final Design
#include "Wire.h"
#include "BlinkM_funcs.h"
#define blinkm_addr 0x00
struct music {
int length;
int backuplength;
char melody[16];
char backup[16];
int beats[16];
int backupbeats[16];
};
typedef struct music music;
//______VARIABLES DEALING WITH AUDIO_____
int speakerMelody = 2;
int speakerBackup = 3;
int buttonState = 0;
int j=0;
int m=0;
int tempo = 100;
int firstTime=1;
//ALL MUSIC DATA GOES HERE
int LENGTH[2][7]={{8, 8, 7, 8, 13, 9, 7}, // All Melody Lengths
{7, 4, 7, 8, 6, 6, 7}};// All Backup Lengths
char MELODY[14][17]={"dfegfageCCCCCCCC",//Song1 Melody
"CbabagfeCCCCCCCC",// Song2 Melody
"cagfegfCCCCCCCCC",// Song3 Melody
"cgaedCbCCCCCCCCC",// Song4 Melody
"cegbagecdfaCbCCC",// Song5 Melody
"defgfecedCCCCCCC",// Song6 Melody
"ffeeddcCCCCCCCCC",// Song7 Melody
"CCaagggCCCCCCCCC",// Song1 Backup
"cegcCCCCCCCCCCCC",// Song2 Backup
"ccedcffCCCCCCCCC",// Song3 Backup
"CCaaCCggCCCCCCCC",// Song4 Backup
"egaabeCCCCCCCCCC",// Song5 Backup
"ecbcedCCCCCCCCCC",// Song6 Backup
"ffeeddcCCCCCCCCC"};//Song7 Backup
int BEATS[14][16]={{3, 1, 1, 3, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0}, //song1 melody speed
{ 1, 1, 1, 1, 1, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0}, //song2 melody speed
{ 4, 2, 1, 1, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song3 melody speed
{ 2, 2, 2, 3, 1, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0}, //song4 melody speed
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, 0, 0}, //song6 melody speed
{ 1, 1, 4, 1, 1, 4, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0}, //song5 melody speed
{ 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song7 melody speed
{ 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song1 backup speed
{ 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song2 backup speed
{ 1, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song3 backup speed
{ 4, 6, 2, 4, 4, 6, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0}, //song4 backup speed
{ 1, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song5 backup speed
{ 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song6 backup speed
{ 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}};//song7 backup speed
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerMelody, HIGH);
digitalWrite(speakerBackup,HIGH);
delayMicroseconds(tone);
digitalWrite(speakerMelody, LOW);
digitalWrite(speakerBackup,LOW);
delayMicroseconds(tone);
}
}
void playMelody(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C'};
int tones[] = { 956, 851, 758, 716, 638, 568, 514, 478 };
// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
/*void playBackup(char note, int duration) {
char names[] = { 'j', 'k', 'l', 'm', 'n', 'h', 'i', 'J' };
int tones[] = { 956, 851, 758, 716, 638, 568, 1014, 478 };
// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
*/
// ______________LIGHT______________________
int i = 0;
int w = 0;
int p = 0;
int buttonsDown = 0;
byte r,g,b;
int delay_time = 10000; // time betwen colors, 10x00 milliseconds = 1 second
//int num_colors = 7; // how many colors are there the list below
byte color_list[][3] = {
{ 0xff, 0x00, 0x00 }, // red
{ 0x00, 0xff, 0x00 }, // green
{ 0x00, 0x00, 0xff }, // blue
{ 0xff, 0xff, 0x00 }, // red+green
{ 0x00, 0xff, 0xff }, // green+blue
{ 0xff, 0x00, 0xff }, // red+blue
{ 0xff, 0xff, 0xff }, // white
{ 0x00, 0x00, 0x00 }, // off
};
//_______________BUTTON VARIABLES________________
int buttonstate[7]={0,0,0,0,0,0,0};
int buttonPin[7] = {4,5,6,7,8,9,10};
struct music conductor(music SONG,int i, int j){
int m;
SONG.length=LENGTH[0][i];
SONG.backuplength=LENGTH[1][i];
for (m=0;m<16;m++){
SONG.melody[m]=MELODY[i][m];
SONG.backup[m]=MELODY[j][m];
SONG.beats[m]=BEATS[i][m];
SONG.backupbeats[m]=BEATS[j][m];
}
return SONG;
}
struct music song1, song2, song3, song4, song5, song6, song7;
void musicTime(music song){
//Serial.println(song.length, DEC);
for (int i = 0; i < song.length; i++) {
//Serial.println(song.melody[i], HEX);
if (song.melody == " ") {
delay(song.beats[i] * tempo); // rest
} else {
playMelody(song.melody[i], song.beats[i] * tempo);
}
// pause between notes
delay(tempo / 2); }
}
void setup()
{
Serial.begin(9600);
/*
conductor(song1, 0, 7);
conductor(song2, 1, 8);
conductor(song3, 2, 9);
conductor(song4, 3, 10);
conductor(song5, 4, 11);
conductor(song6, 5, 12); */
//_______EVERYTHING DEALING WITH SOUND______
pinMode(speakerMelody, OUTPUT);
//__________________LIGHT_______________________
BlinkM_doFactoryReset();
BlinkM_beginWithPower();
BlinkM_stopScript( blinkm_addr ); // turn off startup script
BlinkM_setFadeSpeed( blinkm_addr, 30);
//_________________BUTTONS_____________________
pinMode(buttonPin[0], OUTPUT);
pinMode(buttonPin[1], OUTPUT);
pinMode(buttonPin[2], OUTPUT);
pinMode(buttonPin[3], OUTPUT);
pinMode(buttonPin[4], OUTPUT);
pinMode(buttonPin[5], OUTPUT);
pinMode(buttonPin[6], OUTPUT);
}
void loop()
{
buttonsDown = 0;
for(i=0; i<7; i++){
buttonstate[i] = digitalRead(buttonPin[i]);
buttonsDown += buttonstate[i];
}
if(buttonsDown !=0){
for(w=0;w<7;w++){
Serial.println(w, DEC);
if(buttonstate[w]==1){
Serial.println(digitalRead(buttonPin[w]), DEC);
r = color_list[w][0];
g = color_list[w][1];
b = color_list[w][2];
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
switch(w){
case 0:
song1.length=LENGTH[0][w];
song1.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song1.melody[m]=MELODY[w][m];
song1.backup[m]=MELODY[w+7][m];
song1.beats[m]=BEATS[w][m];
song1.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song1);
break;
case 1:
song2.length=LENGTH[0][w];
song2.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song2.melody[m]=MELODY[w][m];
song2.backup[m]=MELODY[w+7][m];
song2.beats[m]=BEATS[w][m];
song2.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song2);
break;
case 2:
song3.length=LENGTH[0][w];
song3.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song3.melody[m]=MELODY[w][m];
song3.backup[m]=MELODY[w+7][m];
song3.beats[m]=BEATS[w][m];
song3.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song3);
break;
case 3:
song4.length=LENGTH[0][w];
song4.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song4.melody[m]=MELODY[w][m];
song4.backup[m]=MELODY[w+7][m];
song4.beats[m]=BEATS[w][m];
song4.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song4);
break;
case 4:
song5.length=LENGTH[0][w];
song5.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song5.melody[m]=MELODY[w][m];
song5.backup[m]=MELODY[w+7][m];
song5.beats[m]=BEATS[w][m];
song5.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song5);
break;
case 5:
song6.length=LENGTH[0][w];
song6.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song6.melody[m]=MELODY[w][m];
song6.backup[m]=MELODY[w+7][m];
song6.beats[m]=BEATS[w][m];
song6.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song6);
break;
case 6:
song7.length=LENGTH[0][w];
song7.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song7.melody[m]=MELODY[w][m];
song7.backup[m]=MELODY[w+7][m];
song7.beats[m]=BEATS[w][m];
song7.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song7);
break;
}
delay(200); // wait a bit because we don't need to go fast
BlinkM_fadeToRGB( blinkm_addr, 0xff, 0xff, 0xff);
}
}
}
else{
BlinkM_fadeToRGB( blinkm_addr, 0xff, 0xff, 0xff);
delay(100);
Serial.println("The button is not down : WHITE");
}
}
#include "BlinkM_funcs.h"
#define blinkm_addr 0x00
struct music {
int length;
int backuplength;
char melody[16];
char backup[16];
int beats[16];
int backupbeats[16];
};
typedef struct music music;
//______VARIABLES DEALING WITH AUDIO_____
int speakerMelody = 2;
int speakerBackup = 3;
int buttonState = 0;
int j=0;
int m=0;
int tempo = 100;
int firstTime=1;
//ALL MUSIC DATA GOES HERE
int LENGTH[2][7]={{8, 8, 7, 8, 13, 9, 7}, // All Melody Lengths
{7, 4, 7, 8, 6, 6, 7}};// All Backup Lengths
char MELODY[14][17]={"dfegfageCCCCCCCC",//Song1 Melody
"CbabagfeCCCCCCCC",// Song2 Melody
"cagfegfCCCCCCCCC",// Song3 Melody
"cgaedCbCCCCCCCCC",// Song4 Melody
"cegbagecdfaCbCCC",// Song5 Melody
"defgfecedCCCCCCC",// Song6 Melody
"ffeeddcCCCCCCCCC",// Song7 Melody
"CCaagggCCCCCCCCC",// Song1 Backup
"cegcCCCCCCCCCCCC",// Song2 Backup
"ccedcffCCCCCCCCC",// Song3 Backup
"CCaaCCggCCCCCCCC",// Song4 Backup
"egaabeCCCCCCCCCC",// Song5 Backup
"ecbcedCCCCCCCCCC",// Song6 Backup
"ffeeddcCCCCCCCCC"};//Song7 Backup
int BEATS[14][16]={{3, 1, 1, 3, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0}, //song1 melody speed
{ 1, 1, 1, 1, 1, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0}, //song2 melody speed
{ 4, 2, 1, 1, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song3 melody speed
{ 2, 2, 2, 3, 1, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0}, //song4 melody speed
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, 0, 0}, //song6 melody speed
{ 1, 1, 4, 1, 1, 4, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0}, //song5 melody speed
{ 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song7 melody speed
{ 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song1 backup speed
{ 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song2 backup speed
{ 1, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song3 backup speed
{ 4, 6, 2, 4, 4, 6, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0}, //song4 backup speed
{ 1, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song5 backup speed
{ 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //song6 backup speed
{ 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}};//song7 backup speed
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerMelody, HIGH);
digitalWrite(speakerBackup,HIGH);
delayMicroseconds(tone);
digitalWrite(speakerMelody, LOW);
digitalWrite(speakerBackup,LOW);
delayMicroseconds(tone);
}
}
void playMelody(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C'};
int tones[] = { 956, 851, 758, 716, 638, 568, 514, 478 };
// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
/*void playBackup(char note, int duration) {
char names[] = { 'j', 'k', 'l', 'm', 'n', 'h', 'i', 'J' };
int tones[] = { 956, 851, 758, 716, 638, 568, 1014, 478 };
// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
*/
// ______________LIGHT______________________
int i = 0;
int w = 0;
int p = 0;
int buttonsDown = 0;
byte r,g,b;
int delay_time = 10000; // time betwen colors, 10x00 milliseconds = 1 second
//int num_colors = 7; // how many colors are there the list below
byte color_list[][3] = {
{ 0xff, 0x00, 0x00 }, // red
{ 0x00, 0xff, 0x00 }, // green
{ 0x00, 0x00, 0xff }, // blue
{ 0xff, 0xff, 0x00 }, // red+green
{ 0x00, 0xff, 0xff }, // green+blue
{ 0xff, 0x00, 0xff }, // red+blue
{ 0xff, 0xff, 0xff }, // white
{ 0x00, 0x00, 0x00 }, // off
};
//_______________BUTTON VARIABLES________________
int buttonstate[7]={0,0,0,0,0,0,0};
int buttonPin[7] = {4,5,6,7,8,9,10};
struct music conductor(music SONG,int i, int j){
int m;
SONG.length=LENGTH[0][i];
SONG.backuplength=LENGTH[1][i];
for (m=0;m<16;m++){
SONG.melody[m]=MELODY[i][m];
SONG.backup[m]=MELODY[j][m];
SONG.beats[m]=BEATS[i][m];
SONG.backupbeats[m]=BEATS[j][m];
}
return SONG;
}
struct music song1, song2, song3, song4, song5, song6, song7;
void musicTime(music song){
//Serial.println(song.length, DEC);
for (int i = 0; i < song.length; i++) {
//Serial.println(song.melody[i], HEX);
if (song.melody == " ") {
delay(song.beats[i] * tempo); // rest
} else {
playMelody(song.melody[i], song.beats[i] * tempo);
}
// pause between notes
delay(tempo / 2); }
}
void setup()
{
Serial.begin(9600);
/*
conductor(song1, 0, 7);
conductor(song2, 1, 8);
conductor(song3, 2, 9);
conductor(song4, 3, 10);
conductor(song5, 4, 11);
conductor(song6, 5, 12); */
//_______EVERYTHING DEALING WITH SOUND______
pinMode(speakerMelody, OUTPUT);
//__________________LIGHT_______________________
BlinkM_doFactoryReset();
BlinkM_beginWithPower();
BlinkM_stopScript( blinkm_addr ); // turn off startup script
BlinkM_setFadeSpeed( blinkm_addr, 30);
//_________________BUTTONS_____________________
pinMode(buttonPin[0], OUTPUT);
pinMode(buttonPin[1], OUTPUT);
pinMode(buttonPin[2], OUTPUT);
pinMode(buttonPin[3], OUTPUT);
pinMode(buttonPin[4], OUTPUT);
pinMode(buttonPin[5], OUTPUT);
pinMode(buttonPin[6], OUTPUT);
}
void loop()
{
buttonsDown = 0;
for(i=0; i<7; i++){
buttonstate[i] = digitalRead(buttonPin[i]);
buttonsDown += buttonstate[i];
}
if(buttonsDown !=0){
for(w=0;w<7;w++){
Serial.println(w, DEC);
if(buttonstate[w]==1){
Serial.println(digitalRead(buttonPin[w]), DEC);
r = color_list[w][0];
g = color_list[w][1];
b = color_list[w][2];
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
switch(w){
case 0:
song1.length=LENGTH[0][w];
song1.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song1.melody[m]=MELODY[w][m];
song1.backup[m]=MELODY[w+7][m];
song1.beats[m]=BEATS[w][m];
song1.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song1);
break;
case 1:
song2.length=LENGTH[0][w];
song2.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song2.melody[m]=MELODY[w][m];
song2.backup[m]=MELODY[w+7][m];
song2.beats[m]=BEATS[w][m];
song2.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song2);
break;
case 2:
song3.length=LENGTH[0][w];
song3.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song3.melody[m]=MELODY[w][m];
song3.backup[m]=MELODY[w+7][m];
song3.beats[m]=BEATS[w][m];
song3.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song3);
break;
case 3:
song4.length=LENGTH[0][w];
song4.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song4.melody[m]=MELODY[w][m];
song4.backup[m]=MELODY[w+7][m];
song4.beats[m]=BEATS[w][m];
song4.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song4);
break;
case 4:
song5.length=LENGTH[0][w];
song5.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song5.melody[m]=MELODY[w][m];
song5.backup[m]=MELODY[w+7][m];
song5.beats[m]=BEATS[w][m];
song5.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song5);
break;
case 5:
song6.length=LENGTH[0][w];
song6.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song6.melody[m]=MELODY[w][m];
song6.backup[m]=MELODY[w+7][m];
song6.beats[m]=BEATS[w][m];
song6.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song6);
break;
case 6:
song7.length=LENGTH[0][w];
song7.backuplength=LENGTH[1][w];
for (m=0;m<16;m++){
song7.melody[m]=MELODY[w][m];
song7.backup[m]=MELODY[w+7][m];
song7.beats[m]=BEATS[w][m];
song7.backupbeats[m]=BEATS[w+7][m];
}
BlinkM_fadeToRGB( blinkm_addr, r,g,b );
musicTime(song7);
break;
}
delay(200); // wait a bit because we don't need to go fast
BlinkM_fadeToRGB( blinkm_addr, 0xff, 0xff, 0xff);
}
}
}
else{
BlinkM_fadeToRGB( blinkm_addr, 0xff, 0xff, 0xff);
delay(100);
Serial.println("The button is not down : WHITE");
}
}
Subscribe to:
Posts (Atom)