The TouchOSC layout files are independent of the app platform and are loaded through the TouchOSC editor which works on Mac or Windows. Virtual Virgin, Dec 7, 2017. Virtual Virgin, Dec 7, 2017 #8. Quasar Senior Member. 1,871 1,600 Jun 26, 2012.
- TouchOSC Editor is an application created to help you design layouts for the TouchOSC app. TouchOSC is used to send and receive OSC and MIDI messages from your iPad, iPod Touch and iPhone.
- TouchOSC is a modular OSC and MIDI control surface for iPhone, iPod Touch and iPad. It supports sending and receiving Open Sound Control and MIDI messages over Wi-Fi and CoreMIDI inter-app communication and compatible hardware.
Overview
YOU NEED TO USE A USB CABLE TO UPLOAD YOUR PROGRAM – YOU CANNOT USE XBEE TO UPLOAD PROGRAMS TO THE BOARD. YOU ALSO NEED TO DISCONNECT THE XBEE FROM THE ARDUINO BOARD WHILE YOU UPLOAD.
Inthis tutorial, you will learn how to control your Arduino through your iPhone/iPodTouch. The iPhone communicates over Wi-Fi with a Processing sketch running onyour laptop. There are two tutorials; the first one lights up an LED and thesecond one uses two servos to potentially control the movement of your robot.This tutorial assumes some basic knowledge of programming and using the Arduinosketch. The following software must be installed prior to trying the tutorials.
Parts
Arduino microcontroller and carrier board
LiPo battery
iPhone/iPad/iPod Touch
XBee pair with USB dongle(available: ask your instructor)
LED
Jumper wires
Laptop
Figure 1:Routing process courtesy of Maxwell Hill.
Software
1.TouchOSC
Theapp is available via the iTunes Store and costs $4.99. The TouchOSC app for iPhone, iPod Touch, andiPad uses Open Sound Control messages to communicate with computers andmicrocontrollers over Wi-Fi. Once downloaded, sync your device with iTunes to installthe application.
2.TouchOSCEditor
Downloadat http://hexler.net/software/touchosc.Theeditor allows the user to create custom interfaces using knobs, buttons,faders, and even XY pads. Each touch control can be easily edited to output adesirable range of values. Installers are available for Windows, OSX and Linux.
3.Processing
Download at http://processing.org/download/.The values from TouchOSC are sent over Wi-Fi to Processing.Processing also includes graphical tools. Processing is a simple way to createdrawings, animations and interactive graphics. Visualization of data comingfrom an Arduino is fairly straightforward. Code tested with Processing 1.2.1.
4.OpenSoundControl
Unziphttp://www.sojamo.de/libraries/oscP5/download/oscP5-0.9.6.zip
Youneed to move the oscP5 folder into the Processing libraries folder. Otherwise,when compiling your sketch in Processing, the following error will pop up: “Thepackage oscP5 does not exist. You might be missing a library.”
ForMac users the libraries folder is located inside ~/Documents/Processing.
![Touchosc Editor For Mac Java 6 Touchosc Editor For Mac Java 6](/uploads/1/2/6/5/126589812/971397400.png)
ForWindows users the libraries folder is located inside folder 'My Documents'/Processing.
Moveor copy the entire oscP5 folder into the 'libraries' folder. If'libraries’ folder does not exist, create it.
Here is the final folder structure:Processing
libraries
oscP5
examples
library
oscP5.jar
reference
src
Afterlibrary oscP5 has been successfully installed, restart Processing.
Hardware
Laptop,Arduino board, LED, wires, 2 continuous rotation servos. Instead of USBcommunication, the computer can talk to the Arduino using XBee radios. Doing sorequires no additional software, however you must be sure the baud rate of theradios match in the Arduino and Processing software. 2 XBee radios and an USBdongle for wireless control of the Arduino (limited amount) are available in thesupply locker.
Nowthat we have all of the hardware and software required to make the iPhone talkto the Arduino, let’s get started on a simple program.
LED Control Tutorial
Aneasy tutorial for how to control an LED with this routing process can be foundat: http://www.sparkfun.com/tutorials/152.We will follow the Sparkfun tutorial very closely.
Create LED circuit:
You willneed to create a simple circuit with an LED, a resistor, some jumper wires andyour Arduino board connected to a computer via a USB cable. The negative/groundjumper is connected to the first row in the breadboard and the other end intoone of the ground plugs (GND). Place the negative lead into the same row as thenegative jumper. Place the positive end in the next row down. Place either endof the resistor into the same row as the positive end of the LED (second row).Place the other end of the resistor into the third row. Connect the red/positive jumper to pin11 and the other end of the red jumper into the same row of the end of theresistor (thirdrow). Here is what your Arduino should look like:
Figure 2:Wiring for LED control tutorial
Upload Arduino code
Makesure your Arduino is plugged in via the USB cord and open up the Arduinosoftware on your computer. Copy the following code into the empty Arduinowindow:
//----------------------Arduino code-------------------------
int message = 0; // This will hold one byte of the serial message
#define
redLEDPin 11 // What pin is the red LED connected to?
int redLED = 0; // The value/brightness of the LED, can be 0-255
void setup()
{
Serial.begin(9600); //set serial to 9600 baud rate
}
void loop()
{
if (Serial.available() > 0)
{ // Check if there is a new message
message = Serial.read(); // Put the serial input into the message
if (message 'R')
{ // If a capitol R is received...
redLED = 255; // Set redLED to 255 (on)
}
if (message 'r')
{ // If a lowercase r is received...
redLED = 0; // Set redLED to 0 (off)
}
}
analogWrite(redLEDPin, redLED); // Write an analog value between 0-255
}
//----------------------------end Arduino code--------------------------------
Saveyour Arduino sketch by going to the File menu, then Save As. Compile/verifyyour sketch by hitting the play button, wait for the status bar to say “Donecompiling”. Upload the code to your Arduino board by selecting the right arrowbutton in the Arduino interface. Once uploaded open the Serial monitor andtry typing an upper case “R” and hitting enter, this should make the LED lightup. If you type a lower case “r” it should turn the LED off.
If Arduino software can't connect tothe Arduino hardware, try the following:
1) Windows update needs to download theArduino driver.
2) Make sure you've configured serialport + device correctly:
->tools->board-> Arduino Duemilanove or Nano w/ ATmega328
->tools->Serial Port ->COM# (whichever one pops up)
Run Processing code
Touchosc Editor For Mac Java 64
Code tested with Processing 1.2.1. Yourhost computer (i.e. laptop) must be on the same Wi-Fi network as youriPhone/iTouch so that they can communicate. Open Processing. Copy the code frombelow and paste it into an empty Processing window:
//-----------------Processing code-----------------
import oscP5.*; // Load OSC P5library
import netP5.*; // Load net P5library
import processing.serial.*; // Load serial library
Serial arduinoPort; // SetarduinoPort as serial connection
OscP5 oscP5; // Set oscP5 as OSC connection
int redLED = 0; // redLED letsus know if the LED is on or off
int [] led = new int [2]; // Array allows us to addmore toggle buttons in TouchOSC
void setup()
{
size(100,100); // Processingscreen size
noStroke(); // We don’t want an outline or Stroke on our graphics
oscP5 = new OscP5(this,8000); // Start oscP5, listening for incoming messages at port 8000
arduinoPort = new Serial(this, Serial.list()[0], 9600); // Set arduino to 9600 baud
}
void oscEvent(OscMessage theOscMessage)
{
// This runs whenever there is a new OSC message
String addr = theOscMessage.addrPattern(); // Creates a string out of the OSC message
if(addr.indexOf('/1/toggle') !=-1){
// Filters out any toggle buttons
int i = int((addr.charAt(9) )) - 0x30; // returns the ASCII number so convert into a real number by subtracting 0x30
led[i] = int(theOscMessage.get(0).floatValue()); // Puts button value into led[i]
// Button values can be read by using led[0], led[1], led[2], etc.
}
}
void draw()
{
background(50); // Sets thebackground to a dark grey, can be 0-255
if(led[1] 0){ // If led button 1 if off do....
arduinoPort.write('r'); // Sendsthe character “r” to Arduino
redLED = 0; //Sets redLED color to 0, can be 0-255
}
if(led[1] 1){ // If ledbutton 1 is ON do...
arduinoPort.write('R'); // Send thecharacter “R” to Arduino
redLED = 255; // Sets redLEDcolor to 255, can be 0-255
}
fill(redLED,0,0); // Fill rectangle with redLED amount
ellipse(50, 50, 50, 50); // Created an ellipse at50 pixels from the left...
// 50 pixels from the top and a width of 50 and height of 50 pixels
}
//--------------end processingcode------------------------------------
Runthe Processing sketch by hitting the play button, it looks very similar to theCompile button in Arduino. Whenever you want to control your Arduino with youriPhone, Processing has to run on your laptop.
Create User Interface with TouchOSC:
OpenTouchOSC on your laptop. You may need to install java if TouchOSC isn't workingcorrectly. Click on the black empty interface window and select Toggle Button.
Figure 3:TouchOSC Interface
Make sure that you leave the name of the toggle button as “toggle1”. Save yourinterface as whatever name you want, select SYNC. If you cannot sync with youriPhone, you might need to create a network on your laptop. See tricks and troubleshooting below.
Trick: If you have trouble syncing with youriPhone, go to “Layout”, then “Add” in the TouchOSC app.The “Add Layout” menu allows you to directlyenter a host IP address. Once entered, tap on “Editor Hosts”. Select “Sync” onyour laptop. This should do the trick.Or, follow the trouble shooting instructions to setup your own Wi-Finetwork.
Setup your iPhone:
Thereare several steps in order to get your iPhone ready to communicate with theArduino. Since we are communicating over Wi-Fi, we need to make sure we haveknow some network configurations.
1) Determineyour computer (host) IP address
MacInstructions:
Clickon the 'Apple' in the main menu bar and select 'About thisMac' then select 'More Info' and them select'Network', note the IP address given on the IPv4 Address line.
WindowsInstructions:
Clickthe Start menu button on the Windows taskbar. Click 'Run...' on this menu. Type'cmd' in the text box that appears. A command prompt window launches on thedesktop. In this command window, type 'ipconfig /all'. Details are shown foreach of the computer's network adapters. Computers installed with VPN softwareor emulation software will possess one or more virtual adapters. The 'IPAddress' field states the current IP address for that network adapter.
2) Go to the 'setting' on your iPhone/iPod.Select Wi-Fi. On the Wi-Fi page, select the name of the Wi-Fi network (mostlikely “MIT”). A check mark appears by the selected network. Now close theiPhone's Settings.
3) Open the TouchOSC application (on theiPhone) and go into the network setting. Set the Host to the IPv4 Addressnumber from the first step. Set the Port (outgoing) to something like 8000 andthe Port (incoming) to something like 9000. Now, make a note of the 'LocalIP address'.
4) Return to the main menu in TouchOSC app.Under options, turn “Stay Connected” on.
5) Next select your new interface from the listof preset interfaces.
Finally hit “Done”. The toggle button you created on your iPhone should nowturn the LED on/off and update the Processing graphics in real-time as well.
Finally hit “Done”. The toggle button you created on your iPhone should nowturn the LED on/off and update the Processing graphics in real-time as well.
Servo Control Tutorial
Hereis a more advanced tutorial that allows you to drive 2 continuous rotationservos. You will need the Arduino servo library. Plug the servos into channels8 and 9 of your Arduino board. No wiring is actually needed for this tutorial.If you want more servos or actuators, you will have to rewrite some of the codeprovided.
Figure 4:Arduino with 2 servos attached(Channels8 and 9)
Upload Arduino code
//----------------------------start Arduino code--------------------------------
#include <Servo.h> // include servo headers
// this would be whatever pin you want to use
#define
SERVOR 8
#define
SERVOL 9
// global variables
Servo servoL; // initialize left servo
Servo servoR; // init right servo
![Touchosc Editor For Mac Java 6 Touchosc Editor For Mac Java 6](/uploads/1/2/6/5/126589812/116192812.png)
int message = 0; // This will hold one byte of the serial message
// played around with values that sets the servos to neutral position
// these values need to be set for each servo!!!
const
int servoneutralLeft = 1515;
const
int servoneutralRight = 1520;
// set neutral range for servos
const int minneutral = 1400;
const int maxneutral = 1600;
//--- Function: Setup ()
void setup()
{
pinMode (SERVOL, OUTPUT);
pinMode (SERVOR, OUTPUT);
servoL.attach(SERVOL);
servoR.attach(SERVOR);
servoL.writeMicroseconds(servoneutralLeft); // set servo to mid-point
servoR.writeMicroseconds(servoneutralRight); // set servo to mid-point
Serial.begin(9600); //set serial to 9600 baud rate
}
//--- Function: loop ()
void loop()
{
// Check if there is a new message
if (Serial.available() > 0)
{
message = Serial.read(); // Put the serial input into the message
Free Photo Editor For Mac
int val=message; // val to match pwm delay in ms
int tempval=0; // temp storage
// we can send values from 0 to 255 to the arduino.
Pdf Editor For Mac
// both fadders are set up to go from 0 to 1.
// left servo: 0-127, right servo 128-255. should be enough resolution
int minpulse = 127*8/2; // max storage is 0-255.
// Begin LEFT servo code
if (val <= 127)
{
// scale everything from 1000 to 2000
tempval = val*8 + servoneutralLeft - minpulse;
if (tempval > minneutral && tempval < maxneutral)
{
// Creates dead zone at midpoint of the
servoL.writeMicroseconds(servoneutralLeft);
// fader range (neutral) and trims input to neutral
}
else
{
servoL.writeMicroseconds(tempval);
}
}
// End LEFT servo code
// Begin RIGHT servo code
// scale everything from 1000 to 2000
tempval = val*8 + servoneutralRight - minpulse - 128*8;
if (tempval > minneutral && tempval < maxneutral)
{
servoR.writeMicroseconds(servoneutralRight);
// fader range (neutral) and trims input to neutral value
}
else
{
servoR.writeMicroseconds(tempval);
}
}
// End RIGHT servo code
}
//----------------------------end Arduino code--------------------------------
Run Processing code
//----------------------------------start processing code------------------------------------
import oscP5.*; // Load OSC P5 library
import netP5.*; // Load net P5 library
import processing.serial.*; // Load serial library
Serial arduinoPort; // Set arduinoPort as serial connection
OscP5 oscP5; // Set oscP5 as OSC connection
float [] fader = new float [4]; // Array allows us to add more toggle buttons in TouchOSC
int val1 =0; // Fader 1 value
int val2 =0; // Fader 2 value
//--- Function: setup
void setup()
{
oscP5 = new OscP5(this,8000); // Start oscP5, listening for incoming messages at port 8000
arduinoPort = new Serial(this, Serial.list()[0], 9600); // Set arduinoPort to 9600 baud
}
//--- Function: oscEventThis runs whenever there is a new OSC message
void oscEvent(OscMessage theOscMessage)
{
String addr = theOscMessage.addrPattern(); // Creates a string out of the OSC message
// this handles the faders
if(addr.indexOf('/1/fader') !=-1)
{
String list[] = split(addr,'/');
int xfader = int(list[2].charAt(5) - 0x30); // returns the ASCII number so convert into a real number by subtracting 0x30
if(theOscMessage.get(0).floatValue() !=0)
{
fader[xfader] = theOscMessage.get(0).floatValue(); // Puts fader value into fader[i]
// we can send values from 0 to 255 to the arduino.
// both fadders are set up to go from 0 to 1.
// left servo: 0-127, right servo 128-255. should be enough resolution
val1 = (int) (fader[1] * 127.0);
// val1 defines and scales outputs from fader 1, LEFT servo
val2 = (int) (fader[2] * 127.0 + 128.0);
// val2 defines and scales outputs from fader 2, RIGHT servo
}
}
}
//--- Function: draws servo on/off
void draw()
{
arduinoPort.write(val1); // Sends val1 to Arduino, left servo
arduinoPort.write(val2); // Sends val2 to Arduino, right servo
// this is some debugging code to figure out the message sent.
// comment once you are certain the values processing is sending matches your servos.
// int test1 = val1 / 127.0; // Arduino code, message is scaled.
//int test2 = val2 / 127.0 - 128; // Arduino code, message is scaled.
// uncomment if you want to take a look at the values the Arduino is receiving.
//println('Left servo value: ' + test1);
//println('Right servo value: ' + test2);
}
//----------------------------------end processing code------------------------------------
Create User Interface with TouchOSC
You willneed to create 2 fader bars.The valuesshould range from 0 to 1. Select centered. Save interface and sync with iPhonejust as before. Fader1 will be the left servo. Fader2 is the right servo.
Figure 5:Blue fadder corresponds to left servo, red fadder corresponds to right servo.
Address messages sent over TouchOSC
Toaccess different controls (such as the accelerometer data), the TouchOSC manualhas details on all OSC addresses that control the default layout.All values are either Boolean, integer orfloating points:
Inmore detail, ('/1/toggle') means that there is one toggle button onpage 1.
('/2/toggle')means that there is one toggle button on page 2.
('/1/toggle4')means that we are looking at toggle button 4 on page 1.
Forthe example, the accelerometer is hosted under
“/accxyz”
. The best way tofiguring out these different addresses is listen in on the communication byusing println(theOscMessage) i
nsidethe oscEvent
function, and looking at the console at the moment of interaction to pinpointthe address corresponding to the given action. This address is typicallyfollowed by a string corresponding to a set of data variables, like “ff” fortwo float values.Troubleshooting
Here is what you need to do to create acomputer-to-computer network with TouchOSC and an iPhone or iPod Touch if youcannot connect over existing Wi-Fi. These instructions are for a Mac. You mightalso want to consider switching your iPhone to Airplane mode and then turn onlyWi-Fi back on.
1) Click AirPort Status in the OSX menu bar andselect 'Create Network'.
2) Name the network and click 'ok'.
3) Your AirPort Status icon on the computershould change the way it looks
4) Now click on the 'Apple' in themain menu bar and select 'About this Mac' then select 'MoreInfo' and them select 'Network', note the IP address given onthe IPv4 Address line.
5) Now go to the 'setting' on youriPhone/iPod. Select Wi-Fi. On the Wi-Fi page, select the name of the Wi-Finetwork you created in step 2. A check mark appears by the selected network.Now close the iPhone's Settings.
6) Open the TouchOSC application (on theiPhone) and go into the network setting. Set the Host to the IPv4 Addressnumber from step 4. Follow the rest of the instructions above to set up yourphone.
Resources
http://hexler.net/software/touchosc
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=152
http://www.sojamo.de/libraries/oscP5/
http://www.projectallusion.com/1/post/2009/11/iphone-controlled-solar-powered-arduino-tank.html
http://opensoundcontrol.org/
http://www.makesomecode.com/2009/12/30/arduino-osc-iphone-and-dmx/
http://vlrevolution.com/blog/?p=14
http://www.videolife.tk/touchosc/
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1269840697
http://kennysblogworld.com/arduino-projects/
http://innerqube.com/?p=591
http://snipplr.com/view/28120/touchosc-and-processing-accelerometer-example-code/
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=152
http://www.sojamo.de/libraries/oscP5/
http://www.projectallusion.com/1/post/2009/11/iphone-controlled-solar-powered-arduino-tank.html
http://opensoundcontrol.org/
http://www.makesomecode.com/2009/12/30/arduino-osc-iphone-and-dmx/
http://vlrevolution.com/blog/?p=14
http://www.videolife.tk/touchosc/
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1269840697
http://kennysblogworld.com/arduino-projects/
http://innerqube.com/?p=591
http://snipplr.com/view/28120/touchosc-and-processing-accelerometer-example-code/
- Download
If your download is not starting, click here.
Thank you for downloading TouchOSC Editor for Mac from our software portal
The download version of TouchOSC Editor for Mac is 1.8.2. The package you are about to download is authentic and was not repacked or modified in any way by us. The software is periodically scanned by our antivirus system. We also encourage you to check the files with your own antivirus before launching the installation. This download is provided to you free of charge.
TouchOSC Editor antivirus report
This download is virus-free.This file was last analysed by Free Download Manager Lib 6 days ago.
Often downloaded with
- Taco HTML EditTaco HTML Edit is a full-featured HTML editor and PHP editor. As an HTML...DOWNLOAD
- Plain Text EditorPlain Text Editor helps you edit plain text files. You miss a text editor able...$40DOWNLOAD
- Live Interior 3D Standard EditionLive Interior 3D Standard is a powerful and intuitive home and interior design...$29.99DOWNLOAD
- PDF Editor - Pro Edition Edit DocsPDF Reader Pro is a editor/viewer of Portable Document Format (PDF) files. You...$2.99DOWNLOAD
- Learn - iPhoto '11 Edition•2 hours of HD video tutorials! •28 individual video lessons guided by an...$3.99DOWNLOAD
Editors & Converters