顯示具有 97473020TerryKIM 標籤的文章。 顯示所有文章
顯示具有 97473020TerryKIM 標籤的文章。 顯示所有文章

2012年5月13日 星期日

Review by Terry


1. What is your favorite homework?
I was interested in the electronic drawing board which was homework4. At the beginning I could't imagine
how to make it and then finally I made own my board that looks like real painting board on window 7.
In addition to that, fortunately It helped to understand how it works.

2. What did you learn in this course?
I can make any application by processing and arduino because I have learned about how to use program which I used to and how to control. However, I thought need to make sense to do each homeworks and add more functions with application.
Even though I am not a hardware engineer, I can control Arduino board easily with software which I have learned in the class. Moreover, when I had any problem, I tried to find a way to slove it with example on website. I think
their supporting is very nice for beginner.

3. What did you change after this course?
Actually to control the hardware is difficult for software engineer like us. because last semester, I took the
Micro-controller class with classmates. All of them said it is not easy and difficult to understand. But this, arduino,
is really awesome and any software engineer can control anything what he want to do. Later I hopefully want to buy new arduino board and I will make some application or kit useful at my house.

Final Show - Terry & Alvin

This is final show named Hit Mole for interactive media course.






Click below address for watching.

http://www.youtube.com/watch?v=CFYT9LhV4Yo

2012年4月15日 星期日

HW10_04: Arduino LED Show


// source code
int delayTime1 = 100;
int delayTime2 = 200;
int delayTime3 = 300;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
for(int i=13;i>=0;i--)
pinMode(i, OUTPUT);
}
void loop() {

// Port7 to 13 - turn on and turn off
for(int i=13;i>=7;i--)
{
digitalWrite(i, HIGH); // set the LED on
}
delay(delayTime1);
for(int i=13;i>=7;i--)
{
digitalWrite(i, LOW); // set the LED on
}
delay(delayTime3);


// Port0 to 6 - turn on and turn off
for(int i=6;i>=0;i--)
{
digitalWrite(i, HIGH); // set the LED on
}
delay(delayTime1);
for(int i=6;i>=0;i--)
{
digitalWrite(i, LOW); // set the LED on
}
delay(delayTime3);
// Port7 to 13 - decrease and increase
for(int i=7;i<=13;i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
delay(delayTime3);
for(int i=13;i>=7;i--)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
// Port0 to 6 - decrease and increase
for(int i=0;i<=6;i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
delay(delayTime3);
for(int i=6;i>=0;i--)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
delay(delayTime3);
//
for(int i=13;i>=0;i--)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1);
}
delay(delayTime3);
for(int i=13;i>=0;i--)
{
digitalWrite(i, LOW); // set the LED on
delay(delayTime1);
}
delay(delayTime3);

//
for(int i=0;i<=13;i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1);
}
delay(delayTime2);
for(int i=0;i<=13;i++)
{
digitalWrite(i, LOW); // set the LED on
delay(delayTime1);
}
delay(delayTime1);
}



HO09_03: Seven Colorful LEDs

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:

pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}

void loop() {
while(1)
{
for(int i=1; i<=7; i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(100); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(100);
}
}
}

**********************************************************************************

It show seven colorful LED with using port1 to port7. It has same duration to turn on and off.



HW09_02: LED Traffic Light

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:

pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
}

void loop() {
red();
amber();
green();
}
void red()
{
digitalWrite(1, HIGH); // set the LED on
delay(10000); // wait for a second
digitalWrite(1, LOW); // set the LED off
}
void amber()
{
digitalWrite(2, HIGH); // set the LED on
delay(3000); // wait for a second
digitalWrite(2, LOW); // set the LED off
}
void green()
{
digitalWrite(3, HIGH); // set the LED on
delay(10000); // wait for a second
digitalWrite(3, LOW); // set the LED off
}

************************************************************************************

It show traffic Light with using Port1, 2, and 3. Port1 has turn on for 10 seconds and Port2 has turn on for 3 seconds, Port3 is same with port1.

HW09_01 : Blinking LED

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:

pinMode(1, OUTPUT);
}

void loop() {

digitalWrite(1, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(1, LOW); // set the LED off
delay(500); // wait for a second

}

********************************************************************
I knew how to make led turn off and on with Arduino. It show Port1 only is turned on and turned off.

2012年4月14日 星期六

HW06-1 : Kill Mosquitos


The name of this game is Killing Mosquitos. I had learned about how to use array function and image into it. The image of mosquito appear variably and then and then killing are stored into the array function. Finally, all of mosquitos are catched, it will show the scores.

2012年3月12日 星期一

HW05-2 :


int num = 50;

int[] x = new int[num];

int[] y = new int[num];

int r,g,b;

void setup() {

size(400, 272);

noStroke();

smooth();

fill(255, 102);

}

void draw() {

background(0);

// Shift the values to the right

for (int i = num-1; i > 0; i--) {

x[i] = x[i-1];

y[i] = y[i-1];

}

// Add the new values to the beginning of the array

x[0] = mouseX;

y[0] = mouseY;

// Draw the circles

for (int i = 0; i < num; i++) {

r = int(random(255));

g = int(random(255));

b = int(random(255));

fill(r,g,b);

ellipse(x[i], y[i], i/2.0, i/2.0);

}

}

****************************************************************************

This exercise shows colorful circles through mouse pointer. I used with array and random functions to follow the mouse pointer and to show several color for circle. I just learned about
how to use array in processing program.

HW05


PImage img;
int i, j, s, f, y;

void setup()
{
size(1000, 400);
i = 0;
j = 0;
s = 100;
f = 0;
y = 20;
img = loadImage("sun3.jpg");
frameRate(20);
}

void draw()
{
background(255);
// left to right
if((keyPressed == true) && ((key == 'A') || (key == 'a')) ) {
i = i + 20;
}
// right to left
if((keyPressed == true) && ((key == 'B') || (key == 'b')) ) {
i = i - 20;
}
// left to right
if((keyPressed == true) && ((key == 'C') || (key == 'c')) ) {
i += y;
if(i>900) {
i = 900;
y = -y;
}
else if(i<0) {
i = 0;
y = -y;
}
}
// vertical movement
if((keyPressed == true) && ((key == 'D') || (key == 'd')) ) {
j = j + 20;
}
if((keyPressed == true) && ((key == 'E') || (key == 'e')) ) {
j = j - 20;
}
if((keyPressed == true) && ((key == 'F') || (key == 'f')) ) {
j = j + 5;
}
// zoom in and out
if((keyPressed == true) && ((key == 'I') || (key == 'i')) ) {
s = s + 10;
}
if((keyPressed == true) && ((key == 'O') || (key == 'o')) ) {
s = s - 10;
}
// fade in and out
if((keyPressed == true) && ((key == 'H') || (key == 'h')) ) {
f = f + 10;
}
if((keyPressed == true) && ((key == 'J') || (key == 'j')) ) {
f = f - 10;
}

image(img, i, j, s, s);
tint(255, f, f); // Tint blue
}

**************************************************************************

In this exercise, I learned how to control the picture through computer keyboard. The picture can move from left to right or from right to left, even up and down. I can change the color to red and white. In addition to, It can be larger and smaller with keyboard, i and o.

HW04-1

void setup() {

size(500, 400);

strokeWeight(3);

smooth();

background(255);

// colors

fill(255, 0, 0);

rect(0, 0, 50, 50);

fill(0, 255, 0);

rect(0, 50, 50, 50);

fill(0, 0, 255);

rect(0, 100, 50, 50);

fill(0, 0, 0);

rect(0, 150, 50, 50);

// strokes

fill(255);

rect(450, 0, 50, 50);

fill(0);

ellipse(475, 25, 2, 2);

fill(255);

rect(450, 50, 50, 50);

fill(0);

ellipse(475, 75, 6, 6);

fill(255);

rect(450, 100, 50, 50);

fill(0);

ellipse(475, 125, 10, 10);

// functions

fill(255);

rect(450, 150, 50, 50);

fill(0);

text("ERASE", 455, 180);

fill(255);

rect(450, 200, 50, 50);

fill(0);

text("CLEAR", 455, 230);

fill(255);

rect(450, 250, 50, 50);

fill(0);

text("SAVE", 460, 280);

}

void draw()

{

if (mousePressed && mouseX >=0 && mouseX <= 50 && mouseY >= 0 && mouseY <= 50)

stroke(255, 0, 0);

if (mousePressed && mouseX >=0 && mouseX <= 50 && mouseY >= 50 && mouseY <= 100)

stroke(0, 255, 0);

if (mousePressed && mouseX >=0 && mouseX <= 50 && mouseY >= 100 && mouseY <= 150)

stroke(0, 0, 255);

if (mousePressed && mouseX >=0 && mouseX <= 50 && mouseY >= 150 && mouseY <= 200)

stroke(0, 0, 0);

if (mousePressed && mouseX >= 450 && mouseX <= 500 && mouseY >= 0 && mouseY <= 50)

strokeWeight(2);

if (mousePressed && mouseX >= 450 && mouseX <= 500 && mouseY >= 50 && mouseY <= 100)

strokeWeight(6);

if (mousePressed && mouseX >= 450 && mouseX <= 500 && mouseY >= 100 && mouseY <= 150)

strokeWeight(10);

// erase

if (mousePressed && mouseX >= 450 && mouseX <= 500 && mouseY >= 150 && mouseY <= 200)

stroke(255);

// clear

if (mousePressed && mouseX >= 450 && mouseX <= 500 && mouseY >= 200 && mouseY <= 250)

clear();

// save

if (mousePressed && mouseX >= 450 && mouseX <= 500 && mouseY >= 250 && mouseY <= 300)

save("line.tif");

if (mousePressed && mouseX >= 55 && mouseX <= 445 && mouseY >= 0 && mouseY <= 400)

{

line(mouseX, mouseY, pmouseX, pmouseY);

}

}

void clear()

{

noStroke();

fill(255, 255, 255);

rect(52, 0, 395, 400);

}


In this excercise, I learned how to use the function of text and mouse, and to save function of images in processing. It provides 4 colors, 3 stroks and 3 functions with erase, clear, and save.
I can simply use this one to draw any picture what I want.