Author Archives: yerangchoi

About yerangchoi

Hi, I am Yerang. I am originally from South Korea but lived the past 4 years in India before moving to New York. Coding only exists for tumblr to me and I know very little about it. To be honesty, I was not excited for spending hours and hours in front of computer like a nerd, but I am now have excitement for creating fantastic things in this class.

Arduino_Final_Inspiration

Project Proposal

The final project with Arduino is ‘LED lights responding to sounds’. When I was learning programming, I was impressed by a project used algorithm. In the project, you would see different lines, colours that were responsive to sounds on a monitor. With the concept of responding to sounds, I want to use it in my Arduino project. (so that I can display a cool light show in my room?)

Things to consider:

Rhythm, Pitch, Beat

Number of lights

 

The music:

Happy by Pharrell Williams

Inspiration

1. http://www.youtube.com/watch?v=SkrhCUQHKX8

2. http://www.youtube.com/watch?v=3P7JoxfNo-0

3. http://www.youtube.com/watch?v=___XwMbhV4k

4. http://www.youtube.com/watch?v=guppB4cK3oU

 

The midterm (final)

ex

ex1

 

ex3

 

This work has been developed more from the last week. The concept of this project is now collaborated with an idea of ‘memo’ next to the world map. While different flags appear, one can memo on the illustration board.

Changes:

-Size of the map

-Illustration board

 

Problems:

-Image for background of the illustration board does not load

-Code for text to disappear when an image of flag loads

 

Code Continue reading

The places I want to visit

Hello

 

This is the further experiment from the previous exercise.

In this assignment I wanted to put

1. Names of continents appear when the mouse goes different continents.

2. When the mouse is clicked in the different continents, the pictures of flags appear where I want to visit

445

The name of continent shown when the mouse is placed

44

The flags of places I want to visit from different continents shown when the mouse is clicked

 

here is the code

 

Continue reading

Worldmap

Hello!

Screen Shot 2013-10-10 at 10.37.40

So, this is the word map where you can draw according to the colour of the pixel in the image.

 

links;

http://www.openprocessing.org/sketch/115054

 

My initial ideas were;

 

1. Showing different names of continents when mouses moves

2. Zooming in to a specific region and zooming out.

 

However, I was not able to figure this out. So, the outcome of the sketch does not seem as interesting as I thought. But, I think it is alright to fail sometimes…

 

 

Drawing with processing is POSSIBLE!

Things I learnt while doing this project

1. Maths cannot be separated from Processing.

2.;  makes a significant difference.

3.  Referring other people’s coding is very helpful. (I was able to figure out how to use Arc)

 

sketch

In process 2: A sketch of a drawing

before and after

In process 2: The sketch in Processing.

final

Final project: Could you give me a surprise?

http://www.openprocessing.org/sketch/110377

 

Coding

Continue reading

1. Introduction & Processing

Hi, I am Yerang. I am originally from South Korea but lived the past 4 years in India before moving to New York. Coding only exists for tumblr to me and I know very little about it. To be honesty, I was not excited for spending hours and hours in front of computer like a nerd, but I am now have excitement for creating fantastic things in this class.

 

1.Like a game

This is a combination of ‘variables’ and ‘constrain’; examples from Processing. I wanted to combine these two in order to make like an old school styled game. (I forgot the name of the game)

Changes;

-Strock weight in eclipse and a small square.

 

http://www.openprocessing.org/sketch/109368

 

Coding

float mx;
float my;
float easing = 0.05;
int radius = 24;
int edge = 100;
int inner = edge + radius;
void setup() {
size(640, 360);
ellipseMode(RADIUS);
rectMode(CORNERS);
background(0);

}
void draw() {
stroke(153);
strokeWeight(4);
strokeCap(SQUARE);
background(51);

if (abs(mouseX – mx) > 0.1) {
mx = mx + (mouseX – mx) * easing;
}
if (abs(mouseY – my) > 0.1) {
my = my + (mouseY- my) * easing;
}

mx = constrain(mx, inner, width – inner);
my = constrain(my, inner, height – inner);
fill(76);
rect(edge, edge, width-edge, height-edge);
fill(255);
ellipse(mx, my, radius, radius);
int a = 50;
int b = 120;
int c = 180;

line(a, b, a+c, b);
line(a, b+10, a+c, b+10);
line(a, b+20, a+c, b+20);
line(a, b+30, a+c, b+30);

a = a + c;
b = height-b;

line(a, b, a+c, b);
line(a, b+10, a+c, b+10);
line(a, b+20, a+c, b+20);
line(a, b+30, a+c, b+30);

a = a + c;
b = height-b;

line(a, b, a+c, b);
line(a, b+10, a+c, b+10);
line(a, b+20, a+c, b+20);
line(a, b+30, a+c, b+30);
}

 

2.  The last

Changes;

-size(640, 360) to size (640, 400)

-Added strokeWeight(3);

 

http://www.openprocessing.org/sketch/109380

 

 

Coding
void setup() {
size(640, 400);
background(255);

}

void draw() {
// Call the variableEllipse() method and send it the
// parameters for the current mouse position
// and the previous mouse position
variableEllipse(mouseX, mouseY, pmouseX, pmouseY);
}

void variableEllipse(int x, int y, int px, int py) {
float speed = abs(x-px) + abs(y-py);
stroke(speed);
strokeWeight(3);
ellipse(x, y, speed, speed);
}

 

3. The cell

(I have a problem uploading this sketch. )

Changes

-float probabilityOfAliveAtStart = 15; to 30

-int cellSize = 5; to 3

-size (640, 360); to (640, 640)

 

Coding

// Size of cells

int cellSize = 3;

// How likely for a cell to be alive at start (in percentage)
float probabilityOfAliveAtStart = 30;

// Variables for timer
int interval = 100;
int lastRecordedTime = 0;

// Colors for active/inactive cells
color alive = color(0, 200, 0);
color dead = color(0);

// Array of cells
int[][] cells;
// Buffer to record the state of the cells and use this while changing the others in the interations
int[][] cellsBuffer;

// Pause
boolean pause = false;

void setup() {
size (640, 640);

// Instantiate arrays
cells = new int[width/cellSize][height/cellSize];
cellsBuffer = new int[width/cellSize][height/cellSize];

// This stroke will draw the background grid
stroke(48);

noSmooth();

// Initialization of cells
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
float state = random (100);
if (state > probabilityOfAliveAtStart) {
state = 0;
}
else {
state = 1;
}
cells[x][y] = int(state); // Save state of each cell
}
}
background(0); // Fill in black in case cells don’t cover all the windows
}
void draw() {

//Draw grid
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
if (cells[x][y]==1) {
fill(alive); // If alive
}
else {
fill(dead); // If dead
}
rect (x*cellSize, y*cellSize, cellSize, cellSize);
}
}
// Iterate if timer ticks
if (millis()-lastRecordedTime>interval) {
if (!pause) {
iteration();
lastRecordedTime = millis();
}
}

// Create new cells manually on pause
if (pause && mousePressed) {
// Map and avoid out of bound errors
int xCellOver = int(map(mouseX, 0, width, 0, width/cellSize));
xCellOver = constrain(xCellOver, 0, width/cellSize-1);
int yCellOver = int(map(mouseY, 0, height, 0, height/cellSize));
yCellOver = constrain(yCellOver, 0, height/cellSize-1);

// Check against cells in buffer
if (cellsBuffer[xCellOver][yCellOver]==1) { // Cell is alive
cells[xCellOver][yCellOver]=0; // Kill
fill(dead); // Fill with kill color
}
else { // Cell is dead
cells[xCellOver][yCellOver]=1; // Make alive
fill(alive); // Fill alive color
}
}
else if (pause && !mousePressed) { // And then save to buffer once mouse goes up
// Save cells to buffer (so we opeate with one array keeping the other intact)
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
cellsBuffer[x][y] = cells[x][y];
}
}
}
}

 

void iteration() { // When the clock ticks
// Save cells to buffer (so we opeate with one array keeping the other intact)
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
cellsBuffer[x][y] = cells[x][y];
}
}

// Visit each cell:
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
// And visit all the neighbours of each cell
int neighbours = 0; // We’ll count the neighbours
for (int xx=x-1; xx<=x+1;xx++) {
for (int yy=y-1; yy<=y+1;yy++) {
if (((xx>=0)&&(xx<width/cellSize))&&((yy>=0)&&(yy<height/cellSize))) { // Make sure you are not out of bounds
if (!((xx==x)&&(yy==y))) { // Make sure to to check against self
if (cellsBuffer[xx][yy]==1){
neighbours ++; // Check alive neighbours and count them
}
} // End of if
} // End of if
} // End of yy loop
} //End of xx loop
// We’ve checked the neigbours: apply rules!
if (cellsBuffer[x][y]==1) { // The cell is alive: kill it if necessary
if (neighbours < 2 || neighbours > 3) {
cells[x][y] = 0; // Die unless it has 2 or 3 neighbours
}
}
else { // The cell is dead: make it live if necessary
if (neighbours == 3 ) {
cells[x][y] = 1; // Only if it has 3 neighbours
}
} // End of if
} // End of y loop
} // End of x loop
} // End of function

void keyPressed() {
if (key==’r’ || key == ‘R’) {
// Restart: reinitialization of cells
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
float state = random (100);
if (state > probabilityOfAliveAtStart) {
state = 0;
}
else {
state = 1;
}
cells[x][y] = int(state); // Save state of each cell
}
}
}
if (key==’ ‘) { // On/off of pause
pause = !pause;
}
if (key==’c’ || key == ‘C’) { // Clear all
for (int x=0; x<width/cellSize; x++) {
for (int y=0; y<height/cellSize; y++) {
cells[x][y] = 0; // Save all to zero
}
}
}
}