Recitation 3: Sensors by Karen Zhang

Partner: Anna

Introduction:
In the third week’s recitation, we chose one of the listed sensors, built a circuit and interact with the sensor. So I chose joystick, but it looked harder than we thought to let it work. First, there was something wrong with the website link so we were unable to find the code. Second, the Joystick module comprised of two potentiometers which gauge motion along the x and y axis, and a pushbutton for the z axis. Because of this composition, it can be interfaced with Arduino just as if it were two potentiometers.

Here is our code:

// Arduino pin numbers

const int SW_pin = 2; // digital pin connected to switch output

const int X_pin = 0; // analog pin connected to X output

const int Y_pin = 5; // analog pin connected to Y output

int ledPin_1 = 9;

int ledPin_2 = 7;

int X = 0;

int Y = 0;

void setup() {

 pinMode(SW_pin, INPUT);

 digitalWrite(SW_pin, HIGH);

 pinMode(X_pin, INPUT);

 pinMode(Y_pin, INPUT);

 pinMode(ledPin_1, OUTPUT);

 pinMode(ledPin_2, OUTPUT);

 

 Serial.begin(115200);

}

void loop() {

 Serial.print(“Switch:  “);

 Serial.print(digitalRead(SW_pin));

 Serial.print(“\n”);

 Serial.print(“X-axis: “);

 Serial.print(analogRead(X_pin));

 Serial.print(“\n”);

 Serial.print(“Y-axis: “);

 Serial.println(analogRead(Y_pin));

 Serial.print(“\n\n”);

 

 X = analogRead(X_pin);

 int mappedValue = map(X, 0,1023,0,511);

 if(mappedValue > 205) {

   digitalWrite(ledPin_1, HIGH);

 }else{

   digitalWrite(ledPin_1, LOW);

 }

 Y = analogRead(A5);

 int mappedY = map(Y, 0,1023,0,511);

 if(mappedY > 205) {

   digitalWrite(ledPin_2, HIGH);

 }else{

   digitalWrite(ledPin_2, LOW);

 }

 delay(500);

}

At first, we connected the circuit, but the joystick did not work. After checking again, we found that we forgot we should use Serial.begin(115200) instead of using the normal Serial.begin(9600). After we fixed that problem, the joystick still did not work. We asked the instructor for help, and we realized that we made a silly mistake – we created a short cut. After solving this problem, the joystick finally worked! In the video, the green LED did not light very brightly. But if you looked carefully, you will notice the difference.

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?
I did not think specificly what I want to assemble in the recitation. I chose joystick since it is the most interesting sensor. By moving the joystick, the brightness if the lights change. I think it may be used in video games and let children play with it.


Question 2:
Code is often compared to following a recipe or tutorial.  Why do you think that is?I think it is definitely true! The code is compared to following a recipe or tutorial to intruct the computer. Both code and recipe/tutorial are written in an certain format, so it can be correctly followed. And the code is a bridge for people to communicate with the computer.

Question 3:
In 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?

In today’s world, the computer has a strong impact on human behaviors. We heavily rely on technology. We became lazy since the computer can help us memorize things and deal with small things in our daily life. The computer has simplified the way humans think and act. The computer allows us to communicate with people from long distances. However, it also reduces our physical contacts with each other

Leave a Reply