Luke Nguyen – Week 11 Reading

I understand that the author has a somewhat critical view towards that Pictures Under Glass paradigm because it decreases the flexibility of the humans’ hands. However, I do not how to feel towards his plea that humans should work their brains and put them into research to advance themselves. I think we seem to have reached a stagnant point in human timeline where things can only be extrapolated from their descendants. Everything innovative has been done before, and now researchers are working on how to enhance their performance and utility. Until some innovations highly unimaginable, a teletransportation device might be a stretch but I’ll assume a device along the same line, are conceived, we just have to rely on what we have created and achieved.

Reading the rant article gets me to notice how much those who responded to the author’s rant really take most advanced inventions for granted. To them, these inventions, such as the iPad as one of the main targets of the debate, seem to be so high-tech that it is now serving them in their life, not helping them to progress in terms of working and perceiving the world, much less incentivizing them to contribute to developing such inventions further. I do agree that iPad seem more like a toy to children these days than an invention that encourages their curiosity and thinking. I also do agree some adults become man-children in succumbing to the urge of merely using it for not very useful purposes. To attract buyers’ attention, manufacturers need to make products that are advanced enough but still have simple instructions for easy wield. Some people fuss when a product has a steep learning curve.

Reading Reflections- Week 11

A Brief Rant on the Future of Interaction Design

In this reading, the author criticizes current ways we interact with technology, saying they’re not very imaginative and don’t use our skills well. He argues that technology should help us do things better by using our hands and bodies. For example, he talks about the importance of our hands by pointing out that current touchscreens don’t let us feel things, which is important for doing our day to day activities like cleaning, cooking, playing video games etc. The author wants us to think bigger and create technology that works more like our hands and bodies do, giving us more natural and useful ways to interact with it.

Reading this made me think about times when I’ve been frustrated with technology that doesn’t feel intuitive. I remembered struggling with a graphic design program that felt disconnected from how I usually use my hands. It’s interesting to think about how much we rely on our sense of touch in everyday tasks. The author’s idea of creating technology that feels more natural and responsive is something I want to learn more about.

I’m curious about how we can make technology feel more like using our hands. It makes sense that if technology felt more like real life, it would be much easier to use. I wonder what kinds of new inventions might come out of thinking this way, and how they could change the way we do things every day.

A follow-up article

The author’s first article made me think about how I get frustrated with technology that doesn’t feel like how I do things in real life. He said that technology should help us use our hands and bodies better, which I totally agree with. Now, reading the follow up article, I like their ideas even more.

In this follow-up article, he talks more about how technology should work with our natural abilities. He gave examples of how our hands and fingers do things easily, like opening a jar. It made me think about how technology could be more like that. I’m excited about the idea of technology feeling more like real life. But I also wonder how we can make it happen. How can we make technology that really helps us do things better? And how might these advancements impact not just our daily tasks, but also our creativity and well-being?

Reading Reflection – Week 11

I have always imagined future technology, but the way the author describes the future was very eye-opening. I have always thought of a world with smart technology and screens but never considered that our hands could be essential tools for the future. I agree with the author that we perceive the world through touch. The hand is a tool used every day, helping us navigate our lives. However, today’s reading made me realize that the tactile experience is often overlooked when we use our everyday devices.

As children, we learned about different objects in this world through our tactile sense. This experience of learning through touching and using our hands and bodies has shaped who we are today. Thanks to these experiences, I know how to hold a cup, how to throw a ball, and I am familiar with the feelings of sand, rocks, and water. However, if the children of the future start learning things only through ‘pictures under glass,’ they will not be as well-rounded as we are now. They will miss out on knowing how wonderful the world is.

As the author emphasizes the importance of hands, I truly think that this overlooked issue should be addressed in the future with all possible technological advancements. I want to live in a world where my hands are useful. I want to live in a world where technology offers more than just ‘pictures under glass,’ and where I can truly feel the world.

Week 11: Alreem and Aysha’s Musical Instrument

For this week’s assignment, Aysha and I decided to create a simple musical instrument using buttons, potentiometer, and a piezo buzzer. Using these 3 items as our project’s main components allows us to showcase our concept of creative simplicity, in which we emphasize simple design but use our creativity to create some form of abstract output.  We wanted to utilize this concept as our main aim for this project which is to build an instrument that is not only easy to understand from both a schematic and user-design perspective, but also produce a diverse range of musical tones and rhythms. The musical instrument generates tunes when users press the designated buttons on the breadboard, allowing them to craft a unique tune of their own. The potentiometer offers users the ability to adjust the frequency of the tunes produced by the buttons, further enhancing their ability to personalize their musical experience. The hands-on and interactive approach to this project not only promotes personal creativity but also encourages users to experiment with different tone combinations, all within the framework of a simple and user-friendly design.

Below you can find the project’s schematic diagram:

PDF of Schematic here

After finalizing our schematic diagram, we started to build the project using the arduino. The full list of the components used is as follows: 12 wires, 3 330 resistors, 3 buttons, potentiometer, and a piezo buzzer. These components are what helped ensure that the tunes are heard when the buttons are pressed and adjusted when the potentiometer is turned. 

You can see the fully complete project below

Some pictures:

 

 

 

 

 

 

 

 

When coding for this project, we struggled a bit with getting the certain tunes to be the way we wanted them. It was only when we tried and tested several different tunes for the different buttons did we get the rhythm/tunes we wanted for our project. Therefore, that is the part of the code that we are most proud of, which can be seen below:

#include "pitches.h"

// New melodies:
//For Button 1
int melodyPart1[] = {
  NOTE_C4, NOTE_E4, NOTE_G4
};

//For Button 2
int melodyPart2[] = {
  NOTE_A4, NOTE_C5, NOTE_E5
};

//For Button 3
int melodyPart3[] = {
  NOTE_G5, NOTE_E5
};

// Note durations: 4 = quarter note
int noteDurations[] = {
  4, 4, 4
};

//Function to play the tune on the buzzer, melody[] = array that containes the notes that need to be played, melodyLength = the number of notes in the melody array, tempoDelay = the delay (in milliseconds) between each note
void playMelody(int melody[], int melodyLength, int tempoDelay) {
// Initializes thisNote to 0, continues looping as long as thisNote is less than melodyLength, and increments thisNote after each loop
  for (int thisNote = 0; thisNote < melodyLength; thisNote++) {
//Calculates the duration of the current note
    int noteDuration = 1000 / noteDurations[thisNote];
//Plays the current note on the buzzer connected to buzzerPin
    tone(buzzerPin, melody[thisNote], noteDuration);

//Calculates the duration of the pause between the current note and the next note, adds 30% longer pause to the duration
    int pauseBetweenNotes = noteDuration * 1.30;
//Determine how long to wait before playing the next note
    delay(tempoDelay); // Use tempoDelay instead of fixed pauseBetweenNotes

//Stops the buzzer sound from playing the assigned tune by turning off
    noTone(buzzerPin);
  }
}

Overall, this project was an enlightening experience for both Aysha and me. It gave us the opportunity to combine our previous knowledge of working with circuits and programming to create something that is not only functional to users but also quite enjoyable to use. The project’s emphasis on simplicity resonated with us a lot as we wanted the project to speak for itself, which is why we are more than happy to see how by just using a few basic components, we could create a musical instrument of sorts that is capable of producing various tunes. That being said, we still feel like there are areas of improvement for our project. Next time, it would be interesting to explore adding additional features or potentially modes to our makeshift instruments, such as having more piezo buzzers in order for more than one tune to be played. Doing this might help enhance user-experience, creating a more well-rounded project. That being said, we are proud of how far we have come! Despite minor challenges we faced, we were able to collaborate together and successfully create a musical instrument that engages with the users in a personal way.

W11 Assignment- Alreem and Aysha’s Musical Instrument 🎶

For this week’s assignment, Alreem and I decided to create a simple musical instrument using buttons, potentiometer, and a piezo buzzer. Using these 3 items as our project’s main components allows us to showcase our concept of creative simplicity, in which we emphasize simple design but use our creativity to create some form of abstract output.  We wanted to utilize this concept as our main aim for this project which is to build an instrument that is not only easy to understand from both a schematic and user-design perspective, but also produce a diverse range of musical tones and rhythms. The musical instrument generates tunes when users press the designated buttons on the breadboard, allowing them to craft a unique tune of their own. The potentiometer offers users the ability to adjust the frequency of the tunes produced by the buttons, further enhancing their ability to personalize their musical experience. The hands-on and interactive approach to this project not only promotes personal creativity but also encourages users to experiment with different tone combinations, all within the framework of a simple and user-friendly design.

Below you can find the project’s diagrams:

Circuit Diagram

Schematic Diagram
After finalizing our schematic diagram, we started to build the project using the Arduino. The full list of the components used is as follows: 12 wires, 3 330 resistors, 3 buttons, potentiometer, and a piezo buzzer.  These components are what helped ensure that the tunes are heard when the buttons are pressed and adjusted when the potentiometer is turned. You can see the fully complete project below: 


 

 

When coding for this project, we struggled a bit with getting the certain tunes to be the way we wanted them. It was only when we tried and tested several different tunes for the different buttons did we get the rhythm/tunes we wanted for our final project. Therefore, that is the part of the code that we are most proud, which can be seen below:

#include "pitches.h"

// New melodies:
//For Button 1
int melodyPart1[] = {
  NOTE_C4, NOTE_E4, NOTE_G4
};

//For Button 2
int melodyPart2[] = {
  NOTE_A4, NOTE_C5, NOTE_E5
};

//For Button 3
int melodyPart3[] = {
  NOTE_G5, NOTE_E5
};

// Note durations: 4 = quarter note
int noteDurations[] = {
  4, 4, 4
};

//Function to play the tune on the buzzer, melody[] = array that containes the notes that need to be played, melodyLength = the number of notes in the melody array, tempoDelay = the delay (in milliseconds) between each note
void playMelody(int melody[], int melodyLength, int tempoDelay) {
// Initializes thisNote to 0, continues looping as long as thisNote is less than melodyLength, and increments thisNote after each loop
  for (int thisNote = 0; thisNote < melodyLength; thisNote++) {
//Calculates the duration of the current note
    int noteDuration = 1000 / noteDurations[thisNote];
//Plays the current note on the buzzer connected to buzzerPin
    tone(buzzerPin, melody[thisNote], noteDuration);

//Calculates the duration of the pause between the current note and the next note, adds 30% longer pause to the duration
    int pauseBetweenNotes = noteDuration * 1.30;
//Determine how long to wait before playing the next note
    delay(tempoDelay); // Use tempoDelay instead of fixed pauseBetweenNotes

//Stops the buzzer sound from playing the assigned tune by turning off 
    noTone(buzzerPin);
  }
}

Overall, this project was an enlightening experience for both Alreem and I. It gave us the opportunity to combine our previous knowledge of working with circuits and programming to create something that is not only functional to users but also quite enjoyable to use. The project’s emphasis on simplicity resonated with us a lot as we wanted the project to speak for itself, which is why we are more than happy to see how by just using a few basic components, we could create a musical instrument of sorts that is capable of producing various tunes. That being said, we still feel like there are areas of improvement for our project. Next time, it would be interesting to explore adding additional features or potentially modes to our makeshift instruments, such as having more piezo buzzers in order for more than one tune to be played. Doing this might help enhance user-experience, creating a more well-rounded project. That being said, we are proud of how far we have come! Despite minor challenges we faced, we were able to collaborate together and successfully create a musical instrument that engages with the users in a personal way. 

Week 11 reading: A brief rant on the future of interactive design

I always hear rants all about the future of technology, how it’s not the best for the coming generations. Nonetheless, this is the first time I come across an article that has such good arguments on this matter. The writer explicitly and very intricately shows us the objects that require the use of our hands. I found it impressive how he is so aware of the tactile sense, how our hands respond to each object with every movement. This would not be present when everything is within a tap or a swipe of a finger. While the writer makes valid points about this topic, I still don’t see how some of these objects will be replaced by technology in the future, such as opening a jar or drinking water.

While “Pictures under Glass” looks cool and all, I see why the writer is not happy with it. As shown in the video and the images below it, it seems too much, as if it is controlling people’s lives. It’s nice to have everything very easily accessible like that, but will become very disappointing once people forget how to do simplest things, like tying shoelaces.

Overall, I agree with almost everything that was mentioned in this article. We all use phones/laptops/other technologies in our daily lives and cannot imagine what today would look like without them. As the writer said, an iPad or an iPhone is not too bad for now, but will definitely be something to worry about in the future when they start to take over everything.

Week 11 – Creative Reading

A Brief Rant On The Future Of Interaction Design

https://worrydream.com/ABriefRantOnTheFutureOfInteractionDesign/

Introduction (Summary):

“A Brief Rant on the Future of Interaction Design” by Brett Victor is a critique of the direction that interaction design is currently taking. In particular, he takes issue with the fixation on “pictures under glass,” as most interactions are limited to swiping a flat screen. Victor is a champion of designs that make full use of our hands and body, appealing to more of our senses.

Thought (Personal Impact):

Victor’s enthusiastic defense of technology caused me to reevaluate its actual possibilities. His criticism of the pervasive touchscreens made me think of the enjoyable tactile feedback that conventional controls, such as knobs and sliders in music equipment, offer, something touchscreens do not. His viewpoint, which revealed a stalemate in truly inventive consumer technology interfaces, was both energizing and alarming.

Perspective Shift:

The essay caused me to reconsider what I consider to be “innovative” technology. In the past, I associated advancement with devices that were slimmer and had more fluid touch interfaces. Victor’s focus on tactile engagement offers a more expansive meaning of innovation, one that goes beyond merely digitizing human interaction and capability enhancement. His illustrations of more tactile and expressive experiences, such as making music or shaping clay, are potent reminders of the dimensions we lose when we depend just on touchscreen technology.

Novel Thoughts and Important Concerns:
I’m left wondering after reading this essay why interface design’s greater potential isn’t being investigated more thoroughly. Victor mentions this, but he doesn’t go into detail as to why the industry strongly favors touchscreens. Is it because of customer demand, simplicity of manufacturing, or maybe a lack of vision in the tech sector? This lack of conversation is a crucial component in comprehending the obstacles to the ideas Victor supports.

Conclusion:

I find it impossible to see how existing technologies, such as iPads and tablets, could be improved to greatly improve their physical involvement outside of the touchscreen concept. It appears that a different form of technology and product may be needed, one that radically rethinks how we use technology. Furthermore, we see a tendency toward even less hand use with the introduction of VR glasses, pointing to a time when manual engagement may become unnecessary. Victor’s appeal to rethink interaction design, highlighting the necessity to maintain and improve physical engagement in our increasingly digital environment, is made all the more meaningful by this tendency.

 

Responses: A Brief Rant on the Future of Interaction Design

https://worrydream.com/ABriefRantOnTheFutureOfInteractionDesign/responses.html

Bret When one considers how interaction design affects children, Victor’s criticism of contemporary interaction design in “A Brief Rant on the Future of Interaction Design” is particularly poignant. Victor highlights that instead of restricting interactions to “pictures under glass,” there is a need for more tactile and physically engaging interfaces. His interest for the learning and sensory development of youngsters is one really insightful feature. Children may grow reluctant to participate in more hands-on activities like building, crafting, or exploring the natural world if interactions are limited to touchscreens. This restriction may intensify anxieties about getting filthy, using real toys, and even connecting with the outdoors and animals. The article got me thinking about how modern technological trends might affect children’s perception of and interactions with their physical surroundings, in addition to changing how they learn. This could potentially impede children’s natural tendency toward exploration and general development.

 

 

Assignment 7: Musical Instrument

Partner: Hyein Kim

Concept

When we were young, we were taught to sing and play instruments to a song called “떴다 떴다 비행기”. This song is about airplanes and with the introduction to airplanes through this song, we learn more about airplanes and dream of riding it one day. Furthermore, when we played as elementary students in the playground, we always sang this song and looked up to the sky to find some airplanes. Now, as older students, playing this song on our instrument reminds us of our childhood in South Korea.

Circuit

For digital, we used 3 buttons. Each button is connected to the Ground, a 330 ohm resistor and digital input (2, 3, 4). 

For analog, we used a potentiometer and a speaker. The speaker is connected to the Ground and analog input (~9). The potentiometer is connected to 5V, A0, and the Ground.

Playing the song

Changing the tone

Code

We have created a code so that when a button is pressed, the corresponding note is played with a frequency that can be altered up or down by the potentiometer. The constants BASE_NOTE_C4, BASE_NOTE_D4, and BASE_NOTE_E4 are defined at the top of the sketch. To simplify the code, we have used the INPUT_PULLUP function in the ‘setup’ function, which means that the button pin will read HIGH when unpressed and LOW when pressed. 

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP); // Setup as pull-up to simplify wiring
  }
  pinMode(buzzerPin, OUTPUT);
}

In the main program loop, the potentiometer’s value is read from ‘potPin’ and mapped from its reading rand (0 to 1023) to a frequency adjustment range of -100 to +100 Hz. The loop checks each button in the buttonPins array to see if it’s pressed (reads LOW due to the pull-up resistor). If a button is pressed, the function playAdjustedTone() is called.

void loop() {
  int frequencyAdjustment = analogRead(potPin); // Read the potentiometer value
  frequencyAdjustment = map(frequencyAdjustment, 0, 1023, -100, 100); // Map the pot value to a frequency range adjustment

  for (int i = 0; i < 3; i++) {
    if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed
      playAdjustedTone(i, frequencyAdjustment);
    }
  }
}

We wanted to use the potentiometer to adjust the tone. So we have written the playAdjustedTone() function. It calculates the adjusted frequency for the selected note by adding the frequency adjustment value from the potentiometer to the base frequency of the note. It then uses tone(buzzerPin, adjustedFrequency) to play the adjusted note for 100 milliseconds.

void playAdjustedTone(int noteIndex, int adjustment) {
  int baseFrequencies[] = {BASE_NOTE_C4, BASE_NOTE_D4, BASE_NOTE_E4}; // Base frequencies for C, D, E
  int adjustedFrequency = baseFrequencies[noteIndex] + adjustment; // Adjust the frequency based on potentiometer

  tone(buzzerPin, adjustedFrequency); // Play the adjusted note
  delay(100); // Duration of note
  noTone(buzzerPin); // Stop the tone
}

After playing the note, noTone(buzzerPin) stops the buzzer.

Here is the full version of our code:

// Define frequencies for musical notes C, D, E
#define BASE_NOTE_C4 261
#define BASE_NOTE_D4 294
#define BASE_NOTE_E4 329

// Define pin connections
const int buzzerPin = 9;
const int potPin = A0;
const int buttonPins[] = {2, 3, 4}; // Buttons for C, D, E notes

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP); // Setup as pull-up to simplify wiring
  }
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  int frequencyAdjustment = analogRead(potPin); // Read the potentiometer value
  frequencyAdjustment = map(frequencyAdjustment, 0, 1023, -100, 100); // Map the pot value to a frequency range adjustment

  for (int i = 0; i < 3; i++) {
    if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed
      playAdjustedTone(i, frequencyAdjustment);
    }
  }
}

void playAdjustedTone(int noteIndex, int adjustment) {
  int baseFrequencies[] = {BASE_NOTE_C4, BASE_NOTE_D4, BASE_NOTE_E4}; // Base frequencies for C, D, E
  int adjustedFrequency = baseFrequencies[noteIndex] + adjustment; // Adjust the frequency based on potentiometer

  tone(buzzerPin, adjustedFrequency); // Play the adjusted note
  delay(100); // Duration of note
  noTone(buzzerPin); // Stop the tone
}

Reflection

For improvement, we would like to add more buttons so that we can play more musical notes. In this way, the range of songs we can play on the instrument would widen and it would be more entertaining to play along on the instrument. Also, we tried to change the volume of the sound through the potentiometer but was unsuccessful at it. Therefore, for this assignment, we utilized the potentiometer to control the tone instead. In the future, however, we would like to learn and utilize volume control using the potentiometer. 

 

Reading Reflection: Week 11

From time to time, I feel like I rely too much on tools. My phone is an electric device that fulfills my needs in various ways. While my phone supports me in numerous ways, I don’t necessarily need to use my phone all the time for all purposes. For example, instead of reading a book, I use the internet on my phone for summaries. This causes me to miss the experience of reading a book and coming up with my interpretations. Yes, summaries available online are very helpful; however, I don’t have to use my phone to understand the ideas presented in the book. Therefore, my tendency to heavily rely on tools forces me to lose on experiences I could have by doing it myself.

Furthermore, the author talked about our hands, and reading this article made me realize how powerful our hands are. The nerves on our fingertips, the senses, and the strength all made me realize how useful our hands are. Not only do our hands feel the surfaces of things, but they can also manipulate things. Just as our hands naturally tilt to prevent water from pouring out of the cup, our hands have very much power. The article amazed me and I found myself agreeing with the author’s statement “I believe that hands are our future”. Our hands and the human body have great capabilities that we don’t always recognize. Once we recognize how much we can do, we don’t have to rely on other things or limit ourselves in what we can do.

Reading these two articles made me reflect on the current world. Nowadays, humans heavily rely on technology and AI to fulfill our needs. No matter how hard or easy the task may be, I feel like humans prefer to use tools such as technology and AI to do the work. Therefore, human capabilities are not used to their full potential. Sometimes, we think that it is impossible to live without certain tools we have now. However, if we consider the past, life was possible and not all tools available to use are necessary. Then I questioned why humans tend to not do the work themselves and use tools instead. The solution I arrived at was that it was due to convenience. Tools provide great convenience and efficiency. Therefore, even when we know that we can do the work on our own, we choose not to and use the tools. While convenience and efficiency are great, I believe that humans need to find the right balance between the use of tools and our bodies. Our body is the most amazing tool and we don’t have to always rely on other tools to meet our needs. Finding ways to use ourselves would help us utilize our potential and at the same time meet our needs.

Week 11 – “Playing Childhood song with Musical Instrument” by Hayeon Jeong and Hyein Kim

Concept

When we were young, we were taught to sing and play instruments to a song called “떴다 떴다 비행기”. This song is about airplanes and with the introduction to airplanes through this song, we learn more about airplanes and dream of riding it one day. Furthermore, when we played as elementary students in the playground, we always sang this song and looked up to the sky to find some airplanes. Now, as older students, playing this song on our instrument reminds us of our childhood in South Korea. 

Circuit

For digital, we used 3 buttons. Each button is connected to the Ground, a 330 ohm resistor and digital input (2, 3, 4). 

For analog, we used a potentiometer and a speaker. The speaker is connected to the Ground and analog input (~9). The potentiometer is connected to 5V, A0, and the Ground. 

Code

We have created a code so that when a button is pressed, the corresponding note is played with a frequency that can be altered up or down by the potentiometer. The constants BASE_NOTE_C4, BASE_NOTE_D4, and BASE_NOTE_E4 are defined at the top of the sketch. To simplify the code, we have used the INPUT_PULLUP function in the ‘setup’ function, which means that the button pin will read HIGH when unpressed and LOW when pressed. 

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP); // Setup as pull-up to simplify wiring
  }
  pinMode(buzzerPin, OUTPUT);
}

In the main program loop, the potentiometer’s value is read from ‘potPin’ and mapped from its reading rand (0 to 1023) to a frequency adjustment range of -100 to +100 Hz. The loop checks each button in the buttonPins array to see if it’s pressed (reads LOW due to the pull-up resistor). If a button is pressed, the function playAdjustedTone() is called.

void loop() {
  int frequencyAdjustment = analogRead(potPin); // Read the potentiometer value
  frequencyAdjustment = map(frequencyAdjustment, 0, 1023, -100, 100); // Map the pot value to a frequency range adjustment

  for (int i = 0; i < 3; i++) {
    if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed
      playAdjustedTone(i, frequencyAdjustment);
    }
  }
}

We wanted to use the potentiometer to adjust the tone. So we have written the playAdjustedTone() function. It calculates the adjusted frequency for the selected note by adding the frequency adjustment value from the potentiometer to the base frequency of the note. It then uses tone(buzzerPin, adjustedFrequency) to play the adjusted note for 100 milliseconds.

void playAdjustedTone(int noteIndex, int adjustment) {
  int baseFrequencies[] = {BASE_NOTE_C4, BASE_NOTE_D4, BASE_NOTE_E4}; // Base frequencies for C, D, E
  int adjustedFrequency = baseFrequencies[noteIndex] + adjustment; // Adjust the frequency based on potentiometer

  tone(buzzerPin, adjustedFrequency); // Play the adjusted note
  delay(100); // Duration of note
  noTone(buzzerPin); // Stop the tone
}

After playing the note, noTone(buzzerPin) stops the buzzer.

Here is the full version of our code:

// Define frequencies for musical notes C, D, E
#define BASE_NOTE_C4 261
#define BASE_NOTE_D4 294
#define BASE_NOTE_E4 329

// Define pin connections
const int buzzerPin = 9;
const int potPin = A0;
const int buttonPins[] = {2, 3, 4}; // Buttons for C, D, E notes

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP); // Setup as pull-up to simplify wiring
  }
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  int frequencyAdjustment = analogRead(potPin); // Read the potentiometer value
  frequencyAdjustment = map(frequencyAdjustment, 0, 1023, -100, 100); // Map the pot value to a frequency range adjustment

  for (int i = 0; i < 3; i++) {
    if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed
      playAdjustedTone(i, frequencyAdjustment);
    }
  }
}

void playAdjustedTone(int noteIndex, int adjustment) {
  int baseFrequencies[] = {BASE_NOTE_C4, BASE_NOTE_D4, BASE_NOTE_E4}; // Base frequencies for C, D, E
  int adjustedFrequency = baseFrequencies[noteIndex] + adjustment; // Adjust the frequency based on potentiometer

  tone(buzzerPin, adjustedFrequency); // Play the adjusted note
  delay(100); // Duration of note
  noTone(buzzerPin); // Stop the tone
}

Reflection

For improvement, we would like to add more buttons so that we can play more musical notes. In this way, the range of songs we can play on the instrument would widen and it would be more entertaining to play along on the instrument. Also, we tried to change the volume of the sound through the potentiometer but was unsuccessful at it. Therefore, for this assignment, we utilized the potentiometer to control the tone instead. In the future, however, we would like to learn and utilize volume control using the potentiometer.