Robot Art Show
What is the Robot Art Show Project?
The Robot Art Show Project allowed students to use a programming system to create some piece of art showing what they had learned about coding and the system. My Partner and i decided to make a song for our project. We chose the opening to the song 'Despacito' due to the easy to replicate rhythm and simple beauty. To do that we needed to code in certain notes and the frequency of those notes so that the buzzer could play them.
There was a major event that took place that kept me out of school for a week, setting the entire unit back , only giving me three days to create what we could of the song. Below is the copy and pasted Arduino code that was done at the end of the project. Do to not completing, my partner and I decided to continue on with this project for the end of the year project, Do It Better. Because at the moment that is incomplete, this will be updated when the project is complete.
Here is the incomplete code
*/
const int buzzerPin = 9;
const int songLength = 40;
char notes[] = " bFdFdbFdbdgdbgdbadaadaadFbdcbAbbCdeFdFd "; // a space represents a rest
int beats[] = {2,2,2,2,1,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3};
int tempo = 100;
void setup()
{
pinMode(buzzerPin, OUTPUT);
}
void loop()
{
int i, duration;
for (i = 0; i < songLength; i++) // step through the song arrays
{
duration = beats[i] * tempo; // length of note/rest in ms
if (notes[i] == ' ') // is this a rest?
{
delay(duration); // then pause for a moment
}
else // otherwise, play the note
{
tone(buzzerPin, frequency(notes[i]), duration);
delay(duration); // wait for tone to finish
}
delay(tempo/10); // brief pause between notes
}
}
int frequency(char note)
{
int i;
const int numNotes = 8; // number of notes we're storing
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C', 'A', 'F' };
int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523, 466, 369};
for (i = 0; i < numNotes; i++)
{
if (names[i] == note)
{
return(frequencies[i]);
}
}
return(0);
}
What I Learned
This project had a lot of pressure, which can be both good and bad. One of the things that caused pressure was the fact that we started almost a week late, which only gave us three real project days. During this time we had to become familiar with the program and code in the notes to the intro to the song. One of the other issues was that there was a constant struggle working with a partner that was not willing to contribute to the project without prompting, this lead to a slower working rate. However, having to create a large portion of the project, i learned quite quickly. Overall, while the project may be incomplete, it interesting to get experience in a field of engineering that we have not yet worked in.
The Robot Art Show Project allowed students to use a programming system to create some piece of art showing what they had learned about coding and the system. My Partner and i decided to make a song for our project. We chose the opening to the song 'Despacito' due to the easy to replicate rhythm and simple beauty. To do that we needed to code in certain notes and the frequency of those notes so that the buzzer could play them.
There was a major event that took place that kept me out of school for a week, setting the entire unit back , only giving me three days to create what we could of the song. Below is the copy and pasted Arduino code that was done at the end of the project. Do to not completing, my partner and I decided to continue on with this project for the end of the year project, Do It Better. Because at the moment that is incomplete, this will be updated when the project is complete.
Here is the incomplete code
*/
const int buzzerPin = 9;
const int songLength = 40;
char notes[] = " bFdFdbFdbdgdbgdbadaadaadFbdcbAbbCdeFdFd "; // a space represents a rest
int beats[] = {2,2,2,2,1,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3};
int tempo = 100;
void setup()
{
pinMode(buzzerPin, OUTPUT);
}
void loop()
{
int i, duration;
for (i = 0; i < songLength; i++) // step through the song arrays
{
duration = beats[i] * tempo; // length of note/rest in ms
if (notes[i] == ' ') // is this a rest?
{
delay(duration); // then pause for a moment
}
else // otherwise, play the note
{
tone(buzzerPin, frequency(notes[i]), duration);
delay(duration); // wait for tone to finish
}
delay(tempo/10); // brief pause between notes
}
}
int frequency(char note)
{
int i;
const int numNotes = 8; // number of notes we're storing
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C', 'A', 'F' };
int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523, 466, 369};
for (i = 0; i < numNotes; i++)
{
if (names[i] == note)
{
return(frequencies[i]);
}
}
return(0);
}
What I Learned
This project had a lot of pressure, which can be both good and bad. One of the things that caused pressure was the fact that we started almost a week late, which only gave us three real project days. During this time we had to become familiar with the program and code in the notes to the intro to the song. One of the other issues was that there was a constant struggle working with a partner that was not willing to contribute to the project without prompting, this lead to a slower working rate. However, having to create a large portion of the project, i learned quite quickly. Overall, while the project may be incomplete, it interesting to get experience in a field of engineering that we have not yet worked in.