Learn creative coding writing simple programs

102. Control Processing tilting your phone

This is the second intermediate-level Processing tutorial, where we will use a smart-phone to control Processing. Both your computer and the smart-phone must be connected to the same wireless network.
We use a program called Control that allows us to send OSC messages to Processing. Control is totally customizable. You can create your own interfaces in Control, which means that you can add buttons, sliders and knobs to the screen of your smart-phone, and use them to control programs on your computer. Instead of touch components, we will use a component called accelerometer, which sends messages when we tilt the phone in different directions.
To try this out you need a smart-phone, and you need to install Control. After installation you need to configure it, to tell Control who is the recipient of the messages. Each computer on a network, smart-phones included, has an IP address. An IP address for a computer is like phone numbers for people. You have to find out the IP address of your computer, and enter that as a destination in Control. You can use port 10000 in this example. Ports are used to avoid mixing messages. Imagine you have two phones sending messages to the same computer: each phone can send messages to a different port to be able to distinguish them.
The program you will write in Processing needs a library, called OscP5. This library let's Processing understand the OSC messages your phone will be sending. After installing this library you will write a very short program that changes the color of the background depending on how you tilt your phone.

Tags: osc, oscp5, control, android, iphone

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus