# Students/Christina Sanchez

I am a fourth year student majoring in ICAM. I like ICAM because I get to dabble in all sorts of mediums from filmmaking and music to 2-D and 3-D art. I like variety in my life, which is probably why I was drawn to ICAM. I haven't really worked with electronics, but I find it interesting so far!

1.

2.

3.

4.

5.

## Midterm Project

For my midterm project, I wanted to make a game out of completing a circuit. My project is modeled after the game “Operation”. This circuit puts the user to the test. It tests your skills and your concentration. Like the Operation game, the user or player must try to avoid touching anything but the goal, which in this case is anything but the exposed wire. The player has to try to move the looped piece of wire from one end of the cardboard box to the other end without touching the exposed, squiggly wire. If the two wires touch, the buzzer will sound and you lose the game. In other words, the player has to try to avoid completing the circuit if he or she wants to “win”. The buzzer is present in order to notify the user of two things: that the user has lost the game and that the user has completed the circuit. In order to build my project, I used exposed wire so that if you touch the looped piece of the wire with any part of the exposed, squiggly wire the circuit is able to be completed at any given point. I took one end of the exposed wire and attached it to one lead of a 9-volt battery, which consists of insulated wire. The other lead of the 9-volt battery is then attached to one lead of the buzzer. The other lead of the buzzer is then attached to the floating piece of insulated wire, which has a looped piece of exposed wire at the other end of it. Just like how you are in charge of the surgery procedure in the Operation game, in my project you are in control of the circuit. In a way, you get to decide whether or not you want to complete the circuit, but I have made it so that completing the circuit is a negative or an unwanted thing.

## Final Project Proposal

For my final project, I took the nursery rhyme of “Humpty Dumpty” and gave it some “feminine flare”. Women are known to be emotional so I figured I would turn Humpty Dumpty into a female and display her emotions on her face through the use of colors. Certain colors go with certain moods. I wanted to display a bright, warm color when the viewer starts to read the nursery rhyme in order to show how happy Humpty Dumpty is at the beginning. Then towards the end of the nursery rhyme I wanted to display Humpty Dumpty’s sadness through darker, cooler colors. I used both Arduino and Processing in order to light up an RGB LED light. The code for Arduino tells the board which light to turn on, whereas the code for Processing creates a color wheel where I can choose which colors to display. The RGB LED lights up and changes colors according to which color I click on. If you click and drag the mouse over the color wheel, it creates a confusing or “emotional” effect. I also put Humpty Dumpty on a brick wall in order to help the viewer visualize the nursery rhyme.

### Code (Arduino)

//This code belongs in Arduino. //An RGB LED lights up according to a value selected.

1. define START_COLOR_CHAR '^'
2. define END_COLOR_CHAR '\$'
3. define COLOR_SIZE 8
4. define PIN_RED 9 //connect red cathode (leg) to pin 9
5. define PIN_GREEN 11 //connect green cathode (leg) to pin 11
6. define PIN_BLUE 10 //connect blue cathod (leg) to pin 10

char serialMessage[COLOR_SIZE]; unsigned int readChar; unsigned int count; unsigned long color; unsigned int r; unsigned int g; unsigned int b; boolean readingSerial;

void setup() {

``` Serial.begin(9600);
```

}

void loop() {

``` if (Serial.available() > 0 && !readingSerial)
{
if (Serial.read() == START_COLOR_CHAR)
{
}
}
```

}

``` readingSerial = true;
count = 0;

if (Serial.available() > 0)
{
if (readChar == END_COLOR_CHAR || count == COLOR_SIZE)
{
}

else
{
}
}

serialMessage[count] = '\0';

setColor(serialMessage);
```

}

void setColor(char* value) {

``` // Convert Char* to Long
color = atol(value);

// Extract RGB
r = color >> 16 & 0xFF;
g = color >>  8 & 0xFF;
b = color >>  0 & 0xFF;

// Send values to analog pins
analogWrite(PIN_RED, r);
analogWrite(PIN_GREEN, g);
analogWrite(PIN_BLUE, b);
```

}

### Code (Processing)

//This code belongs in Processing. //It creates a color wheel that allows you to click on it. //The RGB LED will respond to the color you click on.

import processing.serial.*;

Serial port;

void setup() {

``` size(100, 150); //window size
noStroke();

// Background
colorMode(HSB, 100);
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
stroke(i, j, 100);
point(i, j);
}
}

// Select port
println(Serial.list());
port = new Serial(this, Serial.list()[1], 9600);
```

}

void draw() {

``` // Only to enable the method mouseDragged
```

}

//click mouse to select color void mouseClicked() {

``` processColor();
```

}

//click and drag mouse to change color of light void mouseDragged() {

``` processColor();
```

}

void processColor() {

``` color c = get(mouseX, mouseY);
noStroke();
fill(c);
rect(0, 100, 100, 50);
sendColorToSerial(c);
```

}

void sendColorToSerial(color colour) {

``` // Get HEX
String hexColor = hex(colour, 6);

// Convert HEC to Number
long numColor = unhex(hexColor);

// Send color number to serial port
port.write("^" + numColor + "\$");
```

}