Book Image

Processing 2: Creative Coding Hotshot

By : Nikolaus Gradwohl
Book Image

Processing 2: Creative Coding Hotshot

By: Nikolaus Gradwohl

Overview of this book

Processing makes it convenient for developers, artists, and designers to create their own projects easily and efficiently. Processing offers you a platform for expressing your ideas and engaging audiences in new ways. This book teaches you everything you need to know to explore new frontiers in animation and interactivity with the help of Processing."Processing 2: Creative Coding Hotshot' will present you with nine exciting projects that will take you beyond the basics and show you how you can make your programs see, hear, and even feel! With these projects, you will also learn how to build your own hardware controllers and integrate devices such as a Kinect senor board in your Processing sketches.Processing is an exciting programming environment for programmers and visual artists alike that makes it easier to create interactive programs.Through nine complete projects, "Processing 2: Creative Coding Hotshot' will help you explore the exciting possibilities that this open source language provides. The topics we will cover range from creating robot - actors performing Shakespeare's "Romeo and Juliet", to generating objects for 3D printing, and you will learn how to run your processing sketches nearly anywhere from a desktop computer to a browser or a mobile device.
Table of Contents (16 chapters)
Processing 2: Creative Coding Hotshot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Changing your face


The current task of our mission is to integrate the prototyped hardware controller we have just created into the Smilie-O-Mat controller. We will extend the program to parse the messages that our Arduino-based controller is sending via the serial port and adjust the sliders to match the values of the hardware knobs. When the user of our controller presses the button on the board, we are going to call the tweet() method.

Engage Thrusters

Let's change our smiley using our controller:

  1. Open the Smilie-O-Mat sketch from our previous mission.

  2. To get access to the serial port, we need to import the serial library, so use the Sketch | Import library … | serial menu to import it.

  3. Now add a Serial object to your sketch:

    import twitter4j.*;
import processing.serial.*;
    
    Serial port;
    
    Twitter twitter;
    String[] tweets = {
      "I feel like so #SmilieOMat",
      "I currently feel like this #SmilieOMat",
      "This is how I feel #SmilieOMat"
    };
    ...
  4. In the setup() method, we need to initialize the serial...