Example Code

Control LabVIEW from the iPhone, iPad or iPod Touch

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW
  • Other

Code and Documents

Attachment

Overview

This is a VI that can send and receive String and 32-bit float data from an iOS app called 'Touch OSC' using the Open Sound Control protocol over UDP.

 

Description

Open Sound Control (OSC) is a content format for messaging among computers, sound synthesizers, and other multimedia devices that are optimized for modern networking technology. Bringing the benefits of modern networking technology to the world of electronic musical instruments, OSC's advantages include interoperability, accuracy, flexibility, and enhanced organization and documentation. [Extract from Wikipedia page on OSC]

 

TouchOSC is a universal iPhone / iPod Touch / iPad application that lets you send and receive Open Sound Control messages over a Wi-Fi network using the UDP protocol.

 

Requirements

Software:

  • LabVIEW 2012 (or compatible)
  • Touch OSC (On iPhone/ iPad)

 

Steps to Implement or Execute Code

1. Run the VI.
2. Enter convenient IP Address of the iPhone/iPad for sending data.
3. Observe the accelerometer measurements on "XYPad" indicator.

 

Additional Information or Resources

 

1.PNG


TouchOSC essentially allows you to quickly create iOS user interfaces using its Java-based TouchOSC Editor (See here for download link) 

 

2.PNG

 

This is then synced to your device using the 'Sync' button in the layout editor and the 'Add' button in the TouchOSC app (seen below) at which point your layout will appear as an option in the TouchOSC layout selector:

 

3.PNG

 

I have set up my settings like this, change appropriate settings to suit you like 'Host' which should be set to your computers Hostname or IP Address that the VI is running on. Make a note of the 'Local IP address' which will be used in the VI.

 

4.PNG

 

 Now if I navigate back to the main menu and click 'Done' I get my user interface:

 

 5.PNG

 

 If my LabVIEW VI is running, I can now receive data from the TouchOSC Interface:

 

6.PNG

 

And if I know the correct control addresses, I can send data back and set the value of numeric controls or labels.

 

7.PNG

2012.png

Note:

A quick summary of the OSC datatypes supported by this vi:
Received Data type support: f, ff, fff
Transmit Data type support: s, f

 

**This document has been updated to meet the current required format for the NI Code Exchange.** 

 

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
jarrydb
Member
Member
on

Thanks for this! Saves me some time

CEEG
Member
Member
on

On OSC server(LV8) download there's the: "no timeout error.vi" missing can you fix that for us?

CEEG
Member
Member
on

i really need this so if u can help me with that, it will be great! thanks btw

Mark_SAI
Active Participant
Active Participant
on

Hey there, I've added it as an attachment. Enjoy.

CEEG
Member
Member
on

thanks alot!

CEEG
Member
Member
on

hey, im having trouble connecting my itouch with my pc, im wondering if the touchOSC version has to do with it, because i have the touchOSC 1.2(2008-2009) and does not conects to the IP-address of my wifi conection, and in the layout tab does not have the "add" option.

CEEG
Member
Member
on

i already solved that! and yes it was the OSC version!

CEEG
Member
Member
on

a video will be great...

Mark_SAI
Active Participant
Active Participant
on

People may find this code snippet useful for working out how to get the name of the control from the osc URL:

controlname.png

sshearman
Member
Member
on

There is also LabVIEW monitoring / control app avail through iTunes: http://itunes.com/apps/VIremote

It looks interesting, but I haven't tried it.

Sam Shearman
mr._maggi
Member
Member
on

Thank you for this amazing introduction, everytining works fine with your VI, but i have problems with my own. At first I am new in Labview (I am better in PLC xD) and my questions is:

How can i switch a LED in Labview on, when i press a button in TouchOsc and how can I switch a LED in ToucOSC on, when i am pressing a switch in Labview??

If I know this little things, maybe I am able to programming my own simple VI. An Example (picture) would be great.

Sorry for my bad english, i hope you could understand me^^

Greetings Mr. Maggi and a second thank you!

Gyc
Member
Member
on

Hi.

I've seen that the TouchOSC platform is also under development for Android whici is VERY nice and opens a lot of possibilities.

Is the TouchOSC layout you used a default or an example? If not, where can I download it from?

Thanks.

effgee
Member
Member
on

The links to the code are all broken; they all point to https://decibel.ni.com/content/docs/DOC-12289

Gyc
Member
Member
on

Guys, it works!!!

With TouchOSC it's quite easy to create new layouts (very close to LV philosophy).

Created a few, downloaded them to the iPod and it worked flawlessly.

And it's fun!!!!!

vitoi
Active Participant
Active Participant
on

Hi macaba,

Just tried TouchOSC and it was relatively easy to get going. It's rather amazing to make a change on a PC and see it move a slider on my iPhone.

Getting it to work from PC to iPhone was easy.

However, I have not been able to get the iPhone to PC messages out. I've checked the port numbers and they are OK on both sides (8000). Tried swapping the port numbers around in case Port 8000 is blocked, but still no luck. There is just no message being detected on the PC/LabVIEW end. Any hints?

Regards,

Vito

David_Ferster
Member
Member
on

Very nice. Easy to set up!

Where do those nice gray VI controls come from? Is there a complete set?

David

Daniel-H
NI Employee (retired)
on

Hey Guys,

In addition to this example for OSC, I wanted to make everyone aware of our current OSC package development.

Eventually, you will be able to download these vi's in the package manager.

You can track our progress and contribute to project on our OSC Community Page.

We're currently working on a couple of example using TouchOSC as well as other iPad apps.

We appreciate anything you may have to add to the project.  Feel free to get involved by joining the group, posting on project discussions, and uploading projects of your own.

Daniel

Applications Engineering

Applications Engineer
National Instruments
PeterLV
Member
Member
on

After some struggle with interfacing it works also for me. Perfectly!

This was my main problem: I was running my IPhone and my IPad at the same time, sharing the same addresses ...

My IPhone is off now during my LabView exercises with TouchOSC...

Daniel-H
NI Employee (retired)
on

Peter,

I'm glad you were able to get things working.

Have you tried using the OSC vi's in the OSC Community Page?

We'd love to hear about your experience with using them.

Daniel

Applications Engineering

Applications Engineer
National Instruments