# Week 14 - Winter Show 2016

### Moody Marble

Analyzing sentiment in a graphical way, using mixtures of two oil color paint.

Partner: Steven Simon

For the final project, I wanted to analyze the user's sentiment based on their word usage. People have a lot of interests in what others think and feel on the same issues. Sentiment analysis can be an excellent source of information and can provide insights that can either determine marketing strategy, improve customer service and product messaging.

This project is about watching user and other participant's sentiment visually.

We have set different words of moods and divided intotwo groups, positive and negative. When the user selects their word, two oil color paints will drip into the big bowl. After placing a piece of paper, each user can make a unique marble paint based on their moods. They can also see and compare the collected sentiment of the whole participants.

Users need to drag and drop the mood blobs to the centered blob. First we created a blob with connecting the vertexes. The vertexes changes its place randomly. So it looks like the rim of the circle moves,  We set the question in the first page, and when user press button, it goes to the main page. Each word has a different score.(Positive: +, Negative: -) When they are finished choosing their mood, it calculates the total score and determine whether you are positive or not. It also shows the average of all the users input.

http://alpha.editor.p5js.org/full/BJFAVuJXl

After several user tests, we made a progress in the code. People actually were confused and had less interest on the last page, where you can see the total score. Also, people wanted to have more fun with dragging and dropping the blob multiple times. So we decided to go much simple way. We deleted a first and last page but added the function that automatically resets the small blob position. We allowed users to experiment freely by not limiting the count for choosing the words.

This is the latest progress of the code.

https://alpha.editor.p5js.org/full/BkAKIFamx

This is the code for Arduino

```int goodLight = 11;
int pin = 5;

int oil = 6;
int water = 9;

// 1 amp 9 volts

int buttonState = LOW;      // the current state of the output pin
int previousButtonState = HIGH;    // the previous reading from the input pin

long time = 0;         // the last time the output pin was toggled
long debounce = 200;

int buttonValue;

void setup() {
Serial.begin(9600);
pinMode(goodLight, OUTPUT);
pinMode(pin, INPUT);
pinMode(water, OUTPUT);
pinMode(oil, OUTPUT);
}

void loop() {

//digitalWrite(9, HIGH);

if (readingButton == HIGH && previousButtonState == LOW && millis() - time > debounce) {
if (buttonState == HIGH){
buttonState = LOW;
}else{
buttonState = HIGH;

time = millis();
}
}

// Handshaking for p5
if (Serial.available() > 0) {
buttonValue = buttonState;
Serial.println(buttonValue);

/*
if (inByte == 111) {
//Key pressed "o"
Serial.println("Input Evaluated");
digitalWrite(led, HIGH);

digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
digitalWrite(led, LOW);

}*/

if (inByte == 98) {
//Good receiving
// Water
Serial.println("Dropping Water");
digitalWrite(goodLight, HIGH);

digitalWrite(water, HIGH);
delay(700);
digitalWrite(water, LOW);
digitalWrite(goodLight, LOW);

}

if (inByte == 99) {
// Oil
Serial.println("Dropping Oil");

digitalWrite(oil, HIGH);
delay(1000);
digitalWrite(oil, LOW);