We met with the problem that I accidentally put a wrong variable in the if box, but the variable wasn’t found out by Arduino automatically. Then we found out that the code that speakers adapt is different from the LED light’s. We need to use ‘tone’ function to make the buzzer work properly. If we want to make the sound playing with lyrics, we can use the example in recitation 2, ‘toneMelody’.
Since we were not familiar with the buzzer code, we decided to use the LED to test the force-sensitive resistor first. Finally, we finished the simple device but failed to alternate the LED to the buzzer because we were running out of time.
Here is our code.
const int analogInPin = A0;
const int analogOutPin = 9;
//I previously left too many useless variables here which made the code messy.
int sensorValue = 0;
int outputValue = 0;
int buzzerState;
void setup() {
Serial.begin(9600);
pinMode(9, INPUT);
}
void loop() {
sensorValue = analogRead(analogInPin);
outputValue = map(sensorValue, 0, 1023, 0, 255);
if (sensorValue > 10) {
buzzerState = HIGH;
} else {
buzzerState = LOW;
}
digitalWrite(9,buzzerState);
//I used the serial monitor a lot to look for mistakes.
Serial.print("\t sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(buzzerState);
delay(1000);
}
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?
Students in NYU Shanghai were often very busy due to the heavy workload, especially during midterm and final. Some of them feel stressed, anxious, and even depressed. Therefore, we want to create a device for them to relieve the pressure and bad emotion. By pressing the force-sensitive resistor, the buzzer would sing a melody for you. Under this circumstance, these people can not only feel more relaxed than before but also enjoy a lovely song during the process.
Question 2: Code is often compared to following a recipe or tutorial. Why do you think that is?
I agree that code is similar to following a recipe or tutorial. Code examples and recipes are both standard processes we can learn from. By following the instructions, we can run the program correctly and cook a delicious meal easily. However, this does not mean that we can just copy them without changing anything. Commands are the same as food. If you like sweeter food, you can add more sugar to dishes. If more components, functions are desired, we can change the code flexibaly according to the content. Overall, I think the similarities between, code, recipe, and tutorial are a standard but not a rigid way of teaching.
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?
Accoring to the Language of New Media, Unlike ads in magazines or other real-world publications, “banner’ ads on Web pages change with every page view. And most of the companies that place the ads on the Web site track your movements across the Net, ‘remembering’ which ads you’ve seen, exactly when you saw them. Increasingly, computers play an important role in all aspects of our lives, and they are spying and recording our lives. It seems that computers can know people better than themselves. People get a digital identity online and this identity can be completely different from the identity in our daily lives. It might result in different consequences, for instance it can cause group unconsciousness. I think that even though computers continue to be controversial and are too powerful than we can imagine, we still need them for evolution and we should learn to take advantage of them better.
