Recitation 11: Workshops – Julie (Marcela)

Recitation 11: Workshops

Instructor: Marcela

In this recitation, I attended the Object Orientated Programming workshop. In this session, we learned about class functions and how it would be useful if we wanted to store multiple things and have them show. We created words that would show (ie potato, onion, carrot) at a specific opacity. We used an ArrayList to further organize the words and allow the code to be dynamic (meaning that we could change the words easily without changing the functionality). 

I asked Tristan if we could make the words disappear by clicking directly on the words itself rather than having the first or last word in the array. We worked on this line of balls example he had. We originally had the clicking working according to the diameter of the  ball, so the ball would disappear if you clicked a little bit outside the circle, but then we adjusted it to fit the radius to be more accurate. 

Recitation 10: Media Controller – Julie (Marcela)

Recitation 10: Media Controller

Instructor: Marcela

This was by far one of the more difficult recitations I’ve had. I wanted to model my sketch after the Hokusai wave exercise we did in class the other day where there were randomly generated bubbles that detected the pixel color of the area. I envisioned an image manipulation where the bubbles would change size based on the potentiometer. I wanted to combine the Hokusai exercise and the ellipse exercise that changed size and location based on the potentiometer. I had a bit of trouble starting off, as I mistakenly used the code that imported multiple Arduino values to Processing, when I only needed the code of important one value from Arduino to Processing. This confused me for a while because I wasn’t sure how to incorporate all the additional code that was unnecessary. After receiving guidance from Leon, I was able to better understand how I was making it more complicated than it should have been. We explored how to make the bubbles take up all the space across the image, rather than just a specific area. Using mappedValue, we were able to map the value received from Arudino’s potentiometer and was then able to evenly distribute the area where the bubbles were increasing and decreasing in size. Leon also explained to me the importance of println function, as it puts a comma in between the values and allows us to receive feedback if the potentiometer is actually working. At one point, my potentiometer was broken (but we didn’t know) and we were confused what was wrong with the code. So after including the println, we were able to figure out that the physical component was broken, and not the code.

Reflection:

Computer vision is heavily integrated into the majority of one’s daily life.  Image manipulation is easily accessible and can be detected by motion/object tracking. In the reading, the author explains how “a rudimentary scheme for object tracking, ideal for tracking the location of a single illuminated point (such as a flashlight), finds the location of the single brightest pixel in every fresh frame of video.” This kind of methodology can explain how filters and image manipulation, particularly with the face, uses technology to alter or add additional elements into the electronic vision. With my project, if we imagine that the potentiometer were the location of the person’s face, we can allow it to represent the size of the bubbles that manipulate the live camera feed.

Processing:

import processing.serial.*;

PImage cow;
Serial myPort;
int valueFromArduino;
int size = 10;

void setup() {

size(500, 500);
background(0);
printArray(Serial.list());
myPort = new Serial(this, Serial.list()[ 5 ], 9600);

cow = loadImage(“IMG_0292.jpg”);
cow.resize(width,height);
noStroke();
}

void draw() {
while ( myPort.available() > 0) {
valueFromArduino = myPort.read();
}
println(valueFromArduino);
int mappedVal =int( map(valueFromArduino, 0, 255, 0, 50));
image(cow,0,0);

for (int y = 0; y <= height; y = y + 50) {
for (int x = 0; x <= width; x = x + 50) {
color c = get(x,y);
fill(c);
ellipse (x,y, mappedVal, mappedVal);
}}}

Arduino:

void setup() {
Serial.begin(9600);}

void loop() {
int sensor1 = analogRead(A0);

Serial.write(sensor1); // This is a byte of data.. 0 – 1023
delay(100);}

Recitation 9: Final Project Process – Julie (Marcela)

Recitation 9: Final Project Process

Instructor: Marcela

Partners: Bing, Jonathan, Kathy

Step 1:

Bing’s Project – Bing and Daniel decided to stray from their midterm project idea of a game and instead create something more purposeful in the way that it gives the user insight into themselves. They wanted to create a heart rate monitor that analyzes your heart rate when you see specific pictures to allow you to better understand what generates an unconscious reaction. After all the pictures are displayed, a graph would display the heart rate for each picture and show which picture impacted the user the most.  We all thought this was a really cool idea and wanted to try it. I really enjoyed how this project would possibly reveal something about me I didn’t know and that I could walk away discovering something about myself. This project embodies a different kind of interaction than we are used to seeing (ie through games, etc.) This interaction was more education and strove to provide insight into somethings you may have not known was important to you. This is a great example of how we can begin to integrate technology into self-discovery and self-exploration.  

I suggested creating a possible database that shows what the average for all the users so the user could compare what invoked them the most vs. others. Another person suggested having a live-time heart rate present on the screen while the pictures are being shown. I think this project has a lot of potential to be super awesome and I can’t wait to see it play out.

Kathy’s Project – Kathy wanted to create something that allows the user to become more aware of their electronic usage, particularly with computers. Her idea was to have something pop up on your screen after a certain amount of time that sets off a physical vehicle that drives around the table, forcing you to get up and chase the car around till you can stop it. Considering how prevalent electronics have become in our modern times, I believe this project would help us become more aware of the long hours we spend on our computer doing school work or leisurely scrolling through Facebook. The idea of disconnection fascinates me and I am a strong advocate of limiting your cellular/computer usage every day to live more in the present world. While some may think this kind of project is just plain annoying, I believe it helps bring awareness to sometimes disconnect from our digital world, and how ironic is it that technology would help us to do so! 

I brought up a problem about having a messy desk, restricting the vehicle from moving around a lot, but we came up with a solution by having the vehicle somewhere stationed on the ground. We all also helped Kathy brainstorm some ideas about how to prolong the vehicle’s drive to make it more of a challenge for the user, and actually prompt the user to move and get up. 

Jonathan’s Project – Jonathan’s project was modeled after the Labyrinth maze game with 2 players: the runner and the Minotaur. Using joysticks, the runner would try and find the exit and the Minotaur would try and catch up to the runner. When I first read about Jonathan’s game, I was absolutely confused as I has no experience ever playing a game like that. But, once he explained the concepts and the functionality, I began to see that it similarly resembled Pac Man and was excited to see where it could go. I liked the challenging aspect of being chased. This project brings together two users to explore an unknown maze world through the common medium of a computer. I believe this project will bring forth aspects of challenge and fun that create an enjoyable experience for players and watchers alike. 

I suggested Jonathan to have some kind of introductory page that explains what Labyrinth and Minotaurs are (since I had no idea). Our group also suggested ways to make the maze more challenging, possible including aspects from Pac Man. 

Interaction Reflection – After learning about my partner’s projects, I think it’s important to understand that there is more to interaction than just games. When we think of interaction, our mind typically floats to some kind of human-to-human interaction where they are doing something, but interaction has many different purposes. I feel that we all had a fairly similar definition of interaction, and our projects go to reinforce the different levels of depth interaction has. For example, the heart rate monitor may connect at a deeper level than the driving vehicle because it reveals something personal to you. Jonathan may also relate more to the Labyrinth game because he has been involved in that kind of mythology since he was a child, while me on the other hand, heard about what Labyrinth was for the first time in that class, indicating that I may not have as deep of a connection with the game than he does.

Step 2:

I received feedback to possible eliminate the competitive aspect (ie. eliminate the 80% advancement) and instead create a collaborative game where the two users work together to compose a song, adding an additional challenge of coordination. Leon suggested following the style of the game Overcooked, where the complexity of working together would create a challenging, exciting factor. Jonathan also suggested creating a quick initial tutorial for the users would know how to work the buttons and how the game works. I also received feedback on how to map out the lines that correspond to the tones. Leon suggested creating an initial mapping that Justin and I create ourselves, and have that as the mapping that the user would try and copy. 

My partners felt that the musical aspect of my project would be the most fun, so they placed a lot of emphasis on the songs that would be chosen especially considering that some students with cultural difference may not know the songs that we deem as “popular” or “well-known”. They suggested having multiple songs to pick from. They thought that the competition would be fun, but is overplayed and too similarly resembling the already existing games. I can understand that, but I also believe competition sparks users to keep playing and is an important part of why those games were so successful. 

I will definitely consider adding a tutorial and the collaborative aspect, but my partner Justin also had a lot of good feedback and ideas from his group that we also plan to implement. To improve our project proposal, we want to find a way to incorporate both competitive and collaborative modes into our game. I think the only thing we won’t be incorporating is having multiple songs to pick from, and that is based purely on time constrains. We want to make sure we have a working project before we expand our music library. 

Final Project Essay – Julie Huang – Marcela

Final Project Essay

Partner: Justin Wu

Project Title: Tip Tap Snap

Project Statement of Purpose 

Basing our project off of a common passion of simply having a good time, Justin and I came to the conclusion of incorporating music (what else makes you want to get up and groove?) into a game that caters to and resonates with a wide range of users. We drew inspiration for our project from games like “Tap Tap Revolution” and “Guitar Hero” and wanted to build off both these amazing games to create something that doesn’t require much technical equipment, but still allows the user to interact with a physical object. Our project strives to bring together fun aspects of music and coordination to create an entertaining experience for users that just want to chill and have a good time.

Project Plan 

The goal of our project is to provide users with a fun gaming experience that brings together musical components, hand-eye coordination, and an added surprise factor. The combination of these aspects bring forth a enjoyable challenge that attracts people to want to continue playing. To create this project, we plan to fabricate a physical game box that connects Arduino to Processing. On top of our box, we plan to have three different colored buttons that correspond to the colors displayed on the screen. When the button is pressed down, a pressure sensor will be triggered and the corresponding color line on the screen will glow to create an obvious indication that the button has been pressed, giving the user feedback. When the pressure on the button is lifted, the corresponding color line will stop glowing. On the screen of the computer, we plan to use Processing to code a main page with different songs that display different lengthed colored lines in a specific order according to the song’s notes/tones. To emphasize with the user, we want to choose songs that has catchy tunes and everyone knows of. During the game process, we plan to have a corresponding accuracy percentage that gives the user feedback on how accurate the user was able to coordinate the buttons to the color lines on the screen, creating a scoring system. At the moment the song ends, we plan to have a camera capture a picture of the user to bring forth an additional aspect of fun. We also plan to have an overall accuracy percentage that allows users to compare with other users and influences them to continue playing until they reach a perfect 100% score. If the user receives an above 80% score, the user is given the option to advance onto the next song.

Our project plan for the following weeks is to begin with a sketch model that represents our general idea for the project and can help us reflect our final goal in our designing process. Once we have a mockup design on paper of the physical components of our project, we then plan to choose two songs or tunes that a majority of people know. By April 28, we hope to finish the ideation process, and can begin to move onto fabrication of the box and Processing with Arduino. By May 5, we hope to have Arduino set-up within the box in accordance to the code written within Processing. From here, we want to implement user testing to get feedback on how to improve our project and to make it more user friendly. We feel that this is a very important aspect of our project process because we learned from our Midterm project that some of the most important improvements we made were from the suggestions given by our peers during user-testing. That next week until the IMA show, we plan to implement feedback into our project and develop our final project.

Context and Significance 

After conducting preparatory research to find inspiration and help shape my definition of interaction, I found myself most intrigued by the projects that embodied some kind of deeper meaning that resonated with the user. However, through this research and the general outcome of our Midterm project, I realized that the trade off of diving into something specific is that the connection generated is very subjective to each person’s individual experience and preferences, meaning that the project would have more of an impact on some people over others. So, I challenged myself to develop an idea that could resonate with a broader audience. This is what led me to reflect back upon distinctive games in my childhood that seemed to be very popular. I stumbled upon games like Tap Tap Revolution, the most downloaded free game app from the App Store in 2008, and games like Guitar Hero and Rock Band. At some point in our lives, we have been exposed to musical songs, tones, or jingles. As a baby, we’ve heard a wide range of nursery songs (ie. Twinkle Twinkle, Old Mcdonald, etc). From exposure to the digital age, through TV ads or being in stores we’ve heard a number of popular songs. Living in Shanghai for long enough, I have come to recognize the Family Mart door jingle. Music and tones are deeply integrated in our daily lives, even if we don’t fully recognize it. So, when I discovered Light Barrier, by Kimchi and Chips, I was inspired to incorporate some aspect of music in my final project. However, while I was in awe with Breaking the Surface, I realized that this project may only resonate deeply with a distinctive group of people that shares the common curiosity of the sea. This led my thinking process for my final project to create something that relates to a wider group of people. And what relates on a broader scale other than music? In addition, I really connected to the game Hit Me!, where two people try and hit a button on each other’s helmet and when one person finally does, the helmet takes a picture of that person in that exact moment. I thought this aspect really

My project proposal covers the general idea of my definition of interaction. Our project allows a continuous relationship between the user, computer, and game box that is composed by verbal feedback of music, physical feedback of the button and the computer screen, and emotional feedback through the indication of how you feeling when you play the game (ie. you may think the game is fun because you are good at accurately pressing the buttons in accordance to the screen). Through the emotional connection, this echos a personal connection that drives the relationship to be pursued further. If the user really enjoys this game or the song we’ve selected, the meaning of the interaction of this game brings is stronger. However, if the user has not developed a prior connection to the song (ie user does not know the song), the interaction connection may not be as strong as someone who recognizes the song.

While there are a lot of games like this out in the world already, both on the digital app market or as games children can play, our project can be set up and integrated into the most space. All you need to have is your computer and our game box. All existing products are only based in an app and don’t have an additional physical component, or requires a very specific musical instrument, but our project utilizes the basic products we have in our daily life and adds an additional factor of fun: a camera that snaps a picture of your face at the end of the song, when the difficulty raises and you see your accuracy score.

Our project is intended for anyone who wants to have a good time, but don’t want to spend as much money to purchase a game station. It brings together people to have fun together and try and beat the game. It contains special value because it is easily accessible, can be set up really anywhere, and has an additional factor that takes a picture of your face.

Ideally, in the future, to create a stronger feedback loop between the user and our game, we could create a larger pool of songs and engineer our game to generate songs that have more difficult order and length of lines. We could also engineer our game box to resemble something that is more consumer orientated. Once we do this, we could really begin to go onto the market and compete with existing products.

Recitation 8: Serial Communication – Julie (Marcela)

Recitation 8: Serial Communication

Instructor: Marcela

Exercise 1: Make a Processing Etch a Sketch

Using the code from Github and with the help of Jingyi, I was able to successfully create the Etch a Sketch. When I first started, I wasn’t able to move the ellipse coded on Processing when I turned the potentiometer connected to Arduino. I wasn’t getting a change in numbers shown on the serial monitor in Processing when I was turning the knob. Jingyi helped me understand that the values from the potentiometer were being printed horizontally on Arduino when I needed the values to be printed vertically so Processing could understand the information being transmitted. We solved the issue by adding Serial.println instead of just having Serial.print. We needed to make the values readable to Processing. Once we had the correct code in Arduino, I ran into the trouble of the ellipse always going out of the margins of Processing box. So to combat this issue, we added a map function to ellipses’s x position and y position values. Once we added this, we were able to keep the movement of the ellipse within the Processing box. Finally, we wanted to comment out background in the void draw () to allow the ellipse to draw a trail, imitating what an Etch a Sketch is like. We commented it out because every time I moved the ellipse via the potentiometer, the background would redraw itself and the whole thing would reset. So, we kept the background function in void setup (). 

Model:

Exercise 2: Make a Musical Instrument with Arduino

I used the code from Github to send values from Processing to Arduino. I wanted to create something where when the mouse is pressed and moved, the pitch of the buzzer would sound accordingly. I was able to get to the point where when the mouse was pressed and moved, the buzzer would sound, but the buzzer made a really gross sound and would continue to increase in pitch even when I stopped pressing down the mouse. With the help of Leon, I was able to understand that that was happening because in Arduino, I was equating two things that were equal at once and it was stressing the Arduino out because it can only register information at a specific speed. It was reading the values as true and making sound at the same time.

We fixed this issue by replacing digitalWrite with tone() instead. With this, we were also able to map the frequency and fix the squeaky sound and have the sound be more smooth when I would press and move the mouse. Here, I searched up how to draw a continuous line on Processing, and integrated that into my code for mousePressed. Now, my code was able to draw a line and alter sound when I pressed down the mouse and moved it around the Processing box. 

Model:

Code for Exercise 1:

Arduino: 

// IMA NYU Shanghai
// Interaction Lab
// For sending multiple values from Arduino to Processingvoid setup() {
Serial.begin(9600);}

void loop() {
int sensor1 = analogRead(A0);
int sensor2 = analogRead(A1);

// keep this format
Serial.print(sensor1);
Serial.print(“,”); // put comma between sensor values
Serial.println(sensor2);

// too fast communication might cause some latency in Processing
// this delay resolves the issue.
delay(100);
}

Processing: 

// IMA NYU Shanghai
// Interaction Lab
// For receiving multiple values from Arduino to Processing

/*
* Based on the readStringUntil() example by Tom Igoe
* https://processing.org/reference/libraries/serial/Serial_readStringUntil_.html
*/

import processing.serial.*;

String myString = null;
Serial myPort;

int NUM_OF_VALUES = 2; /** YOU MUST CHANGE THIS ACCORDING TO YOUR PROJECT **/
int[] sensorValues; /** this array stores values from Arduino **/

void setup() {
size(500, 500);
background(0); //if background in draw not called, circles drawn on top of all
setupSerial();
}

void draw() {
updateSerial();
printArray(sensorValues);

fill(255);
ellipse(map(sensorValues[0],0,1023,0,width), map(sensorValues[1],0,1023,0,height),50,50);
//
}

void setupSerial() {
printArray(Serial.list());
myPort = new Serial(this, Serial.list()[ 5 ], 9600);
// WARNING!
// You will definitely get an error here.
// Change the PORT_INDEX to 0 and try running it again.
// And then, check the list of the ports,
// find the port “/dev/cu.usbmodem—-” or “/dev/tty.usbmodem—-”
// and replace PORT_INDEX above with the index number of the port.

myPort.clear();
// Throw out the first reading,
// in case we started reading in the middle of a string from the sender.
myString = myPort.readStringUntil( 10 ); // 10 = ‘\n’ Linefeed in ASCII
myString = null;

sensorValues = new int[NUM_OF_VALUES];
}

void updateSerial() {
while (myPort.available() > 0) {
myString = myPort.readStringUntil( 10 ); // 10 = ‘\n’ Linefeed in ASCII
if (myString != null) {
String[] serialInArray = split(trim(myString), “,”);
if (serialInArray.length == NUM_OF_VALUES) {
for (int i=0; i<serialInArray.length; i++) {
sensorValues[i] = int(serialInArray[i]);
}
}
}
}
}

Exercise 2:

Arduino:

// IMA NYU Shanghai
// Interaction Lab/**

#define NUM_OF_VALUES 2 /** YOU MUST CHANGE THIS ACCORDING TO YOUR PROJECT **/

/** DO NOT REMOVE THESE **/
int tempValue = 0;
int valueIndex = 0;

/* This is the array of values storing the data from Processing. */
int values[NUM_OF_VALUES];

void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(9,OUTPUT);
}

void loop() {
getSerialData();

if (values[0]==1){
tone(9,map(values[1],0,500,31,4990));

}
else{
noTone(9);
// }

//tone(9,values[1]);

}

//recieve serial data from Processing
void getSerialData() {
if (Serial.available()) {
char c = Serial.read();
//switch – case checks the value of the variable in the switch function
//in this case, the char c, then runs one of the cases that fit the value of the variable
//for more information, visit the reference page: https://www.arduino.cc/en/Reference/SwitchCase
switch (c) {
//if the char c from Processing is a number between 0 and 9
case ‘0’…’9′:
//save the value of char c to tempValue
//but simultaneously rearrange the existing values saved in tempValue
//for the digits received through char c to remain coherent
//if this does not make sense and would like to know more, send an email to me!
tempValue = tempValue * 10 + c – ‘0’;
break;
//if the char c from Processing is a comma
//indicating that the following values of char c is for the next element in the values array
case ‘,’:
values[valueIndex] = tempValue;
//reset tempValue value
tempValue = 0;
//increment valuesIndex by 1
valueIndex++;
break;
//if the char c from Processing is character ‘n’
//which signals that it is the end of data
case ‘n’:
//save the tempValue
//this will b the last element in the values array
values[valueIndex] = tempValue;
//reset tempValue and valueIndex values
//to clear out the values array for the next round of readings from Processing
tempValue = 0;
valueIndex = 0;
break;
//if the char c from Processing is character ‘e’
//it is signalling for the Arduino to send Processing the elements saved in the values array
//this case is triggered and processed by the echoSerialData function in the Processing sketch
case ‘e’: // to echo
for (int i = 0; i < NUM_OF_VALUES; i++) {
Serial.print(values[i]);
if (i < NUM_OF_VALUES – 1) {
Serial.print(‘,’);
}
else {
Serial.println();
}
}
break;
}
}
}

Processing:

// IMA NYU Shanghai
// Interaction Lab

import processing.serial.*;

int NUM_OF_VALUES = 2; /** YOU MUST CHANGE THIS ACCORDING TO YOUR PROJECT **/

Serial myPort;
String myString;

// This is the array of values you might want to send to Arduino.
int values[] = new int[NUM_OF_VALUES];

void setup() {
size(500, 500);
background(0);

printArray(Serial.list());
myPort = new Serial(this, Serial.list()[ 5 ], 9600);
// check the list of the ports,
// find the port “/dev/cu.usbmodem—-” or “/dev/tty.usbmodem—-”
// and replace PORT_INDEX above with the index of the port

myPort.clear();
// Throw out the first reading,
// in case we started reading in the middle of a string from the sender.
myString = myPort.readStringUntil( 10 ); // 10 = ‘\n’ Linefeed in ASCII
myString = null;
}

void draw() {
//background(0);

stroke(255);
if (mousePressed == true) {
line(mouseX, mouseY, pmouseX, pmouseY);
values[0]=1;
}
else{
values [0]=0;
}
//if(mousePressed){
// values[0]=1;
//}

// if(keyPressed){
// values[1]=1;
// }
// else{
// values[1]=0;
//}

values[1]=mouseX;

//values[3]=mouseY;

// changes the values
//for (int i=0; i<values.length; i++) {
// values[i] = i; /** Feel free to change this!! **/
//}

// sends the values to Arduino.
sendSerialData();

// This causess the communication to become slow and unstable.
// You might want to comment this out when everything is ready.
// The parameter 200 is the frequency of echoing.
// The higher this number, the slower the program will be
// but the higher this number, the more stable it will be.
echoSerialData(200);
}

void sendSerialData() {
String data = “”;
for (int i=0; i<values.length; i++) {
data += values[i];
//if i is less than the index number of the last element in the values array
if (i < values.length-1) {
data += “,”; // add splitter character “,” between each values element
}
//if it is the last element in the values array
else {
data += “n”; // add the end of data character “n”
}
}
//write to Arduino
myPort.write(data);
}

void echoSerialData(int frequency) {
//write character ‘e’ at the given frequency
//to request Arduino to send back the values array
if (frameCount % frequency == 0) myPort.write(‘e’);

String incomingBytes = “”;
while (myPort.available() > 0) {
//add on all the characters received from the Arduino to the incomingBytes string
incomingBytes += char(myPort.read());
}
//print what Arduino sent back to Processing
print( incomingBytes );
}