The Circuits:
circuits code:
#include “pitches.h”
// notes in the melody:
int melody[] = {
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4, 8, 8, 4, 4, 4, 4, 4
};
int sensorPin = A1; // select the input pin for the potentiometer
int buzzerPin = 8; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin (9600);
pinMode(sensorPin, INPUT);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// read the value from the sensor:
uint16_t value = analogRead (sensorPin);
double distance = get_IR (value); //Convert the analog voltage to the distance
//Serial.println (value); //Print the data to the arduino serial monitor
Serial.print (distance);
Serial.println (” cm”);
Serial.println ();
if (distance < 10) {
tone(8, NOTE_A3);
}
if (distance >= 10 && distance < 30) {
tone(8, NOTE_G3);
}
if (distance >= 30 && distance < 50) {
tone(8, NOTE_G3);
}
if (distance >= 50 && distance< 70 ) {
tone(8, NOTE_C4);
}
if (distance >= 70) {
noTone(8);
}
Serial.println (distance);
delay(500);
}
//return distance (cm)
double get_IR (uint16_t value) {
if (value < 16) value = 16;
return 2076.0 / (value – 11.0);
}
Question 1: What did you intend to assemble in the recitation exercise? If your sensor/actuator combination were to be used for pragmatic purposes, who would use it, why would they use it, and how could it be used?
We are going to make an Infrared Distance Sensor with a different melody. The buzzer will play the songs with different tones. We use the data of the sensor as an input and the buzzer as an output. Then the range of code on Arduino will receive the data from the sensor which will stimulate the different tones by the distance of hand. Different tones depend on the distance your hand with the sensor. The notes in these different tones add up to something like a complete piece of music. We can even create beautiful music by varying the distance between the hand and the sensor. I think it’s a really interesting design. When my partner and I were discussing how to add some fancy functions to the sensor, she suddenly suggested adding more musical elements to the code. Although it wasn’t easy, we asked Andy for help. I think that this product can be used as an electronic instrument which can use in the future in the band. In this play pattern, the performer can combine dance with play behavior.
Question 2: Code is often compared to following a recipe or tutorial. Why do you think that is?
I think recipes and coding, help us do our projects better. Coding is like recipes, containing opponents, procedures, and goals to achieve. Firstly, the recipe contains ingredients and processes of cooking. You can follow every step from the recipe to cooking food. Same as the code that code will represent a standard for input stuff which will stimulate it to do the next step. Same that the behavior of input stuff is according to the code.
Question 3: In The Language of New Media, Manovich describes the influence of computers on new media. In what ways do you believe the computer influences our human behaviors?
I think in the era before computers, people often spend a lot of time on manual recording, calculation. This would take a lot of time and be inefficient. Computers helped people solve these problems soon after they appeared. Computers can improve human productivity more efficiently. For example, the analysis and processing of a lot of big data will make it easier for human beings to summarize rules and help them better complete some complex tasks. At the same time, human beings can put more energy into the innovation research of products rather than memorizing data and information. Moreover, computers can also help humans better simulate the virtual environment. Some product designs and experimental ideas of humans can be simulated on the computer first, which can reduce the number of mistakes and help to achieve better success.