Team: Hannah, Vanessa, Het, Suvina
Date: 09/25/2023
In this class, we learned how to use sound with an Arduino, and we were going to use it for a fun team project.
Brainstorming ✨
Our project journey started with a range of sound-themed ideas. After some lively discussions, we discovered that all four of us had a shared vision: to design a musical instrument using an Arduino. While we initially toyed with the idea of making a piano, we eventually settled on a more intriguing challenge – crafting a xylophone.
Before we started, we studied the sensors. it was the first time I had come across such an interesting material. Then, we chose to develop a simple set of five chords (C, D, E, F, G), tailored for easy playability by children while enabling them to recreate familiar tunes. Initially, without access to a speaker, we utilized LEDs as a creative approach to learn the ropes of the Piezo Sensor. When you touch the sensor, the LED lights up!
void setup() {
Serial.begin(9600);
pinMode (A0, INPUT);
pinMode (A1, INPUT);
pinMode (A2, INPUT);
pinMode (A3, INPUT);
pinMode (A4, INPUT);
pinMode (2, OUTPUT);
}
void loop() {
int sensorValue[5];
sensorValue[0] = analogRead(A0);
sensorValue[1] = analogRead(A1);
sensorValue[2] = analogRead(A2);
sensorValue[3] = analogRead(A3);
sensorValue[4] = analogRead(A4);
if (sensorValue[0]>100){
tone(2,261.63,100);
}
if (sensorValue[1]>80){
tone(2,293.67,100);
}
if (sensorValue[2]>80){
tone(2,329.63,100);
}
if (sensorValue[3]>40){
tone(2,392,100);
}
if (sensorValue[4]>80){
tone(2,440,100);
}
}