Physical Computing INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
-
Upload
carter-bryant -
Category
Documents
-
view
220 -
download
3
Transcript of Physical Computing INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Physical ComputingPhysical Computing
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Processing Tutorial 1“Getting Started”
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
The Processing equivalent of a "Hello World" program is simply to draw a line:
line(35, 25, 70, 90);
Processing Tutorial 1“Getting Started”
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Static programming command lines
size(400, 400); background(192, 64, 0); stroke(255); line(150, 25, 270, 350);
Processing Tutorial 1“Getting Started”
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
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); }
Processing Tutorial 1“Getting Started”
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
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); }
Processing Tutorial 1“Getting Started”
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
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); }
Processing Tutorial 2Variables
tutorial2
Variable Declaration: int var; // type name
Variable Initialization:
var = 10; // var equals 10
Using Variable:
var = var+1;
INST. Kerem Odabaşı - YTU - Interactive Telecomunication Design Dept.
Data
Primitivebooleanbytecharcolordoublefloatintlong
CompositeArrayArrayListHashMapObjectStringXMLElement
Processing Tutorial 3for()
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 3Objects
tutorial3.
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 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.