wiki:fof_workshop
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| wiki:fof_workshop [2017/11/29 20:53] – [Session 4 => Processing Sketch] barkin | wiki:fof_workshop [2024/06/28 19:11] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Workshop at University of the Arts Berlin | 1. December 2017 ===== | ||
| + | |||
| + | In her book »[[https:// | ||
| + | |||
| + | **Workshop Participants** | ||
| + | |||
| + | * Prof. Felix Beck (Assistant Professor of Practice of Design New York University Abu Dhabi) | ||
| + | * Prof. Pablo Dornhege (Guest Professor University of the Arts Berlin, Class for Exhibitiondesign) | ||
| + | * Cristina Achury | ||
| + | * Nils Hoepke | ||
| + | * Junqiao Huang | ||
| + | * Ting Liu | ||
| + | * Edgar Ludert | ||
| + | * Ismael Sanou | ||
| + | * Afra Schanz | ||
| + | * Sandra Stiehler | ||
| + | * Julius Winckler | ||
| + | |||
| + | **Documentation** | ||
| + | |||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | |||
| + | ===== Session 1 => Paper Folding ===== | ||
| + | |||
| + | **Example Structures** | ||
| + | |||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | |||
| + | Look at the above structures and set them into an architectural context. Imagine those structures to become a carrier of information using different media: For instance printed images (e.g. as [[https:// | ||
| + | |||
| + | ===== Session 2 => Shortcut for switching layer compositions in Photoshop ===== | ||
| + | |||
| + | My favourite Photoshop feature is the [[https:// | ||
| + | |||
| + | {{: | ||
| + | |||
| + | …or create an individual short-cut. The screenshots below lead you through the steps of how to create such a short-cut. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== Session 3 => Arduino Sketch ===== | ||
| + | |||
| + | < | ||
| + | // Including necessary libraries | ||
| + | #include < | ||
| + | |||
| + | //10 Mega Ohm Resistor between pins 7 and 8, you may also connect the antenna on pin 8 | ||
| + | CapacitiveSensor cs_7_8 = CapacitiveSensor(7, | ||
| + | |||
| + | // Declaring required variables | ||
| + | unsigned long csSum; | ||
| + | bool initial = true; | ||
| + | char val; | ||
| + | |||
| + | |||
| + | // Initial setup that runs only once in the beginning | ||
| + | void setup() { | ||
| + | // Initiating the serial connection between Arduino and computer | ||
| + | Serial.begin(9600); | ||
| + | |||
| + | // Letting Arduino know that the builtin LED will be used | ||
| + | pinMode(LED_BUILTIN, | ||
| + | } | ||
| + | |||
| + | |||
| + | // Main program loop | ||
| + | void loop() { | ||
| + | |||
| + | // The loop for the inital handshake with the Processing code | ||
| + | // Basically, Arduino board broadcasts " | ||
| + | // it receives " | ||
| + | // back to the computer to show that it received the message | ||
| + | while (initial) { | ||
| + | |||
| + | // Keep sending " | ||
| + | Serial.println(" | ||
| + | |||
| + | // Wait for 50 milliseconds | ||
| + | delay(50); | ||
| + | |||
| + | // If any data is available to read from the serial connection | ||
| + | if (Serial.available()) { | ||
| + | | ||
| + | // Read it and store it in val | ||
| + | val = Serial.read(); | ||
| + | |||
| + | // If the read value is 2 | ||
| + | if (val == ' | ||
| + | | ||
| + | for (int x = 0; x < 5; x++) { | ||
| + | |||
| + | // Send " | ||
| + | Serial.println(" | ||
| + | |||
| + | // Wait for 50 milliseconds | ||
| + | delay(50); | ||
| + | } | ||
| + | |||
| + | // Get out of the hand shake process | ||
| + | initial = false; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // Read the pins and communicate with the computer | ||
| + | // This function does the main job of letting the | ||
| + | // computer know that someone has touched to the pin 8 | ||
| + | CSread(); | ||
| + | | ||
| + | } | ||
| + | |||
| + | |||
| + | // Function definition | ||
| + | void CSread() { | ||
| + | |||
| + | // Sensor resolution is set to 80 | ||
| + | long cs = cs_7_8.capacitiveSensor(80); | ||
| + | |||
| + | // Arbitrary number to detect the chnages | ||
| + | if (cs > 100) { | ||
| + | |||
| + | // Accumulate the reading values | ||
| + | csSum += cs; | ||
| + | |||
| + | // This value is the threshold, a High value means it takes longer to trigger | ||
| + | if (csSum >= 4000) { | ||
| + | |||
| + | if (csSum > 0) { | ||
| + | csSum = 0; //Reset | ||
| + | } | ||
| + | |||
| + | //Stops readings | ||
| + | cs_7_8.reset_CS_AutoCal(); | ||
| + | |||
| + | // turn the LED on (HIGH is the voltage level) | ||
| + | digitalWrite(LED_BUILTIN, | ||
| + | |||
| + | // Send " | ||
| + | Serial.println(" | ||
| + | |||
| + | // Wait for 50 milliseconds | ||
| + | delay(50); | ||
| + | | ||
| + | } else { | ||
| + | |||
| + | //Timeout caused by bad readings | ||
| + | csSum = 0; | ||
| + | |||
| + | // turn the LED off by making the voltage LOW | ||
| + | digitalWrite(LED_BUILTIN, | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | ===== Session 4 => Processing Sketch ===== | ||
| + | |||
| + | < | ||
| + | // Import required libraries | ||
| + | import java.awt.Robot; | ||
| + | import java.awt.event.KeyEvent; | ||
| + | import java.io.IOException; | ||
| + | import processing.serial.*; | ||
| + | |||
| + | // Declare required variables | ||
| + | Serial myPort; | ||
| + | int maxPort; | ||
| + | int correctPort; | ||
| + | |||
| + | String val; | ||
| + | |||
| + | boolean found = false; | ||
| + | boolean initial = true; | ||
| + | boolean setupFinished = false; | ||
| + | |||
| + | int x = 1; | ||
| + | |||
| + | PImage tick; | ||
| + | PFont f; | ||
| + | |||
| + | ////////////////////////////////////////////////////////////////////////////// | ||
| + | / | ||
| + | |||
| + | // Command key + Shift key + Number One (1) | ||
| + | int keyInput[] = { | ||
| + | KeyEvent.VK_META, | ||
| + | KeyEvent.VK_SHIFT, | ||
| + | KeyEvent.VK_1 | ||
| + | }; | ||
| + | |||
| + | /* KeyEvent.VK_META is the cmd key for **macs** | ||
| + | /* KeyEvent.VK_CONTROL is the ctrl key for **windows** pcs */ | ||
| + | /* KeyEvent.VK_ALT is the alt key */ | ||
| + | /* KeyEvent.VK_SPACE is the space bar */ | ||
| + | /* KeyEvent.VK_GREATER is the ">" | ||
| + | /* KeyEvent.VK_A is the " | ||
| + | / | ||
| + | /** https:// | ||
| + | ////////////////////////////////////////////////////////////////////////////// | ||
| + | |||
| + | |||
| + | // Initial setup that runs only once in the beginning | ||
| + | void setup() { | ||
| + | size(250, 250); | ||
| + | // List all the available serial ports | ||
| + | printArray(Serial.list()); | ||
| + | |||
| + | // Get the number of the avaliable ports | ||
| + | maxPort = Serial.list().length; | ||
| + | |||
| + | // Required initializations | ||
| + | tick = loadImage(" | ||
| + | // | ||
| + | f = createFont(" | ||
| + | background(255, | ||
| + | |||
| + | textFont(f); | ||
| + | fill(0); | ||
| + | text(" | ||
| + | delay(1000); | ||
| + | } | ||
| + | |||
| + | |||
| + | // The main program loop | ||
| + | void draw() { | ||
| + | |||
| + | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| + | |||
| + | / | ||
| + | /* This part of the program finds the port which is connected to the Arduino board. Later, it initiates the */ | ||
| + | /* handshake between the Arduino board and processing code */ | ||
| + | |||
| + | // Find the correct port which arduino is connected | ||
| + | while (!setupFinished) { | ||
| + | |||
| + | while (!found) { | ||
| + | |||
| + | for (int x = 0; x < maxPort; x++) { | ||
| + | |||
| + | try { | ||
| + | // Try to connect to the port | ||
| + | myPort = new Serial(this, | ||
| + | |||
| + | // read it and store it in val | ||
| + | val = myPort.readStringUntil(' | ||
| + | val = trim(val); | ||
| + | |||
| + | // If read data is " | ||
| + | if (val.equals(" | ||
| + | |||
| + | found = true; | ||
| + | correctPort = x; | ||
| + | // Print it out in the console | ||
| + | println(" | ||
| + | } | ||
| + | } | ||
| + | catch (Exception e) { | ||
| + | // Handle the error, or just print it, like: | ||
| + | println(" | ||
| + | println(" | ||
| + | |||
| + | try { | ||
| + | myPort.clear(); | ||
| + | myPort.stop(); | ||
| + | } | ||
| + | catch(Exception b) { | ||
| + | } | ||
| + | } | ||
| + | |||
| + | println(" | ||
| + | |||
| + | // Wait for 100 milliseconds | ||
| + | delay(100); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // Print it out in the console | ||
| + | println(" | ||
| + | |||
| + | try { | ||
| + | // Try to send " | ||
| + | myPort.write(" | ||
| + | } | ||
| + | catch (Exception h) { | ||
| + | // Handle the error, or just print it, like: | ||
| + | println(h.getMessage()); | ||
| + | |||
| + | // Try again to connect to the port | ||
| + | myPort.clear(); | ||
| + | myPort.stop(); | ||
| + | myPort = new Serial(this, | ||
| + | } | ||
| + | |||
| + | try { | ||
| + | // read it and store it in val | ||
| + | val = myPort.readStringUntil(' | ||
| + | val = trim(val); | ||
| + | |||
| + | if (val.equals(" | ||
| + | setupFinished = true; | ||
| + | // Print it out in the console | ||
| + | println(" | ||
| + | println(" | ||
| + | println(" | ||
| + | } else { | ||
| + | // Print it out in the console | ||
| + | println(" | ||
| + | } | ||
| + | } | ||
| + | catch (Exception z) { | ||
| + | } | ||
| + | |||
| + | delay(100); | ||
| + | |||
| + | background(255, | ||
| + | textFont(f); | ||
| + | fill(0); | ||
| + | text(" | ||
| + | |||
| + | image(tick, 47, 45, tick.width/ | ||
| + | } | ||
| + | |||
| + | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| + | |||
| + | / | ||
| + | /* This part of the program is the main part that send the key stokes to the operating system | ||
| + | |||
| + | // The main program loop | ||
| + | try { | ||
| + | // read it and store it in val | ||
| + | val = myPort.readStringUntil(' | ||
| + | val = trim(val); | ||
| + | |||
| + | // If button is touched | ||
| + | if (val.equals(" | ||
| + | setupFinished = true; | ||
| + | |||
| + | try { | ||
| + | Robot robot = new Robot(); | ||
| + | robot.delay(500); | ||
| + | |||
| + | // Start sending key strokes to the operating system | ||
| + | for (int i = 0; i < keyInput.length; | ||
| + | robot.delay(25); | ||
| + | |||
| + | robot.keyPress(keyInput[i]); | ||
| + | |||
| + | robot.delay(25); | ||
| + | } | ||
| + | | ||
| + | // Finish sending key strokes to the operating system | ||
| + | for (int i = 0; i < keyInput.length; | ||
| + | |||
| + | robot.delay(25); | ||
| + | |||
| + | robot.keyRelease(keyInput[i]); | ||
| + | |||
| + | robot.delay(25); | ||
| + | } | ||
| + | |||
| + | // Print it out in the console | ||
| + | if (x == 1) { | ||
| + | println(" | ||
| + | x = 0; | ||
| + | } else { | ||
| + | println(" | ||
| + | x = 1; | ||
| + | } | ||
| + | |||
| + | // Get the current date time information | ||
| + | int s = second(); | ||
| + | int m = minute(); | ||
| + | int h = hour(); | ||
| + | |||
| + | String sVal, mVal, hVal; | ||
| + | |||
| + | if (s<10) { | ||
| + | sVal = Integer.toString(s); | ||
| + | sVal = " | ||
| + | } else { | ||
| + | sVal = Integer.toString(s); | ||
| + | } | ||
| + | |||
| + | if (m<10) { | ||
| + | mVal = Integer.toString(m); | ||
| + | mVal = " | ||
| + | } else { | ||
| + | mVal = Integer.toString(m); | ||
| + | } | ||
| + | |||
| + | if (h<10) { | ||
| + | hVal = Integer.toString(h); | ||
| + | hVal = " | ||
| + | } else { | ||
| + | hVal = Integer.toString(h); | ||
| + | } | ||
| + | |||
| + | fill(255); | ||
| + | stroke(255); | ||
| + | rect(0, 203, 250, 50); | ||
| + | |||
| + | textFont(f); | ||
| + | fill(0); | ||
| + | text(" | ||
| + | text(hVal +":" | ||
| + | } | ||
| + | | ||
| + | catch (Exception r) { | ||
| + | // Handle the error, or just print it, like: | ||
| + | r.printStackTrace(); | ||
| + | exit(); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | catch (Exception m) { | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Here is the " | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== Bibliography ===== | ||
| + | |||
| + | * Gjerde, Eric, [[https:// | ||
| + | * Jackson, Paul, [[https:// | ||
| + | * Jackson, Paul, [[https:// | ||
| + | * Moussavi, Farshid, [[https:// | ||
| + | * Moussavi, Farshid, [[https:// | ||
| + | * Zeier, Franz, [[https:// | ||
