Physical Interaction in Communication Design

Physical Computing
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 1
“Getting Started”
The Processing equivalent of a
"Hello World" program is simply to draw a line:
line(35, 25, 70, 90);
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 1
“Getting Started”
Static programming command lines
size(400, 400);
background(192, 64, 0);
stroke(255);
line(150, 25, 270, 350);
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 1
“Getting Started”
Interactive Programming, adding setup(), draw() and “HELLO MOUSE’”
void setup()
{
size(400, 400);
stroke(255);
background(192, 64, 0);
}
void draw()
{
line(150, 25, mouseX, mouseY);
}
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 1
“Getting Started”
Interactive Programming, adding setup(), draw() and “HELLO MOUSE”
void setup()
{
size(400, 400);
stroke(255);
background(192, 64, 0);
}
void draw()
{
background(192, 64, 0);
line(150, 25, mouseX, mouseY);
}
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 1
“Getting Started”
Interactive Programming, adding setup() and draw() and “HELLO MOUSE”
void setup()
{
size(400, 400);
stroke(255);
background(192, 64, 0);
}
void draw()
{
line(150, 25, mouseX, mouseY);
}
void mousePressed()
{
background(192, 64, 0);
}
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 2
Variables
Data
Primitive
boolean
byte
char
color
double
float
int
long
Composite
Array
ArrayList
HashMap
Object
String
XMLElement
Variable Declaration:
int var; // type name
Variable Initialization:
var = 10; // var equals 10
Using Variable:
var = var+1;
INST. Kerem Odabaşı - YTU - Interactive
tutorial2 Telecomunication Design Dept.
Processing Tutorial 3
for()
void setup()
{
size(470, 200);
println(“Hello World”);
}
void draw()
{
background(off);
stroke(on);
for (int i = 0; i <= 13; i++)
{
rect(420 - i * 30, 30, 20, 20);
}
}
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 3
Objects
Human data
* Height.
* Weight.
* Gender.
* Eye color.
* Hair color.
Human functions
* Sleep.
* Wake up.
* Eat.
* Ride some form of transportation.
INST. Kerem Odabaşı - YTU - Interactive
tutorial3. Telecomunication Design Dept.
Processing Tutorial 4
“Processing - Arduino Handshake”
Download Library Files From www.arduino.cc
http://www.arduino.cc/playground/Interfacing/Processing
DownloadProcessing Library: processing-arduino-0017.zip
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 4
“Processing - Arduino Handshake”
Instructions
Unzip the library and copy the "arduino" folder into the "libraries" sub-folder of your Processing Sketchbook.
(You can find the location of your Sketchbook by opening the Processing Preferences.
If you haven't made a "libraries" sub-folder, create one.)
Run Arduino, open the Examples > Firmata > StandardFirmata sketch, and upload it to the Arduino board.
Configure Processing for serial: http://processing.org/reference/libraries/serial/
In Processing, open one of the examples that comes with with the Arduino library.
Edit the example code to select the correct serial port.
Run the example.Run the example.
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 4
“Processing - Arduino Handshake”
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.