This week for me has been a very interesting week, as is the field I most enjoy as creative coder so I focused in try as many possible ways to connect a serial device with different language programming including visual programming languages (VPL). So I explored a lot, research even more, but lot of testing without time to get deeper.

Lesson

Academany Fab-2016.05.18D Lesson 16: Interface and Application Programming from Fab Academy on Vimeo.

Review

At volunteer time, as It looks that nobody wanted to talk I share with my classmates many different and less common ways to send and receive serial, is from 1.02H and you can see a live demo of Unity and one of my boards, blinking when Unity rotate a 3d scanned model.

Academany Fab-2016.05.25B Review 16: Interface and Application Programming from Fab Academy on Vimeo.

Project

In the project page you have also some use of this lesson, as I made a little test with Unity and a simple application in Openframeworks to show the holograms

Visual Programming languages

I Use this simple Arduino code to just send serial data.

void setup() {
Serial.begin(9600);
}

void loop() {

for (int i = 0; i < 360; i++) {
Serial.println(i);
delay(15);
}
}

Quartz Composer

Quartz Composer is a VLP application that can be download freely as part of the Xcode utils and has been several years around, with not many improvements by Apple, but still useful thankful of several developers and users that add some functionalities. One of the most famous is Kineme.net that are the ones that create VUO after add lot of new nodes like the SerialIO (Input Output) I use to get data from serial protocol used by our AVR micro-controllers.

The programs we do usually are called patches, and are a collection of nodes linked in a hierarchy. We use the Input serial data node to get the data sent by our boards. In this patch we rotate a cube with the int generated

post-image

These are the properties of the Input node

post-image

Here you can see a little video of the running patch

Download here the composition for Quartz Composer.

Vuo

With the increased difficulty to continue developing new add-ons for Quartz in new Apple Mac OS versions and the lack of investment in new functionalities, the guys of Kineme.net create their own Quartz Compose style language, called Vuo.

Has a Free version that you can use for learning, and it's license is not very expensive, so it's a good application for learning multimedia creative coding as has OSC, Midi, Kinect nodes for example.

Again I create a cube which it's rotation is controlled by the data sent by serial for the device we selected in the node address.

post-image

A video with the cube rotating

Download here the composition for Vuo.

Game engine Unity 3D

post-image

We have to be sure we get the full Net 2.0 instructions for Api compatibility.

post-image

Unity Preview

Click here for unity preview

C# programming

OpenFrameworks

Example of code for getting a serial connection

Cinder

You can find anything you need about this frameworks in C in libcinder.org

post-image

You can add different libraries from the project generator, in this case OSC one

post-image

You can appreciate the segment of code that you have below and how you got to console the serial input of the Arduino sketch

post-image

Cinder serial methods

post-image

Video of the serial connection.

Python + WX Python

In the MTM assignment of week 9 and 10 I programmed most of the GUI of the Mcnulty Foam cutter with WxPython. As is related to Interface Application I remind it.

post-image

Swift (Objective C imports)

ORSSerialPort

CocoaPods

Swift the new programming language of Apple can make serial calls but with a trick because you embedded the more classic Objetive C inside Swift

Using ORSSerialPort to open a port and send data can be as simple as this:

ORSSerialPort *serialPort = [ORSSerialPort serialPortWithPath:@"/dev/cu.KeySerial1"];
serialPort.baudRate = @4800;
[serialPort open];
[serialPort sendData:someData]; // someData is an NSData object
[serialPort close]; // Later, when you're done with the port

Or, in Swift:

let serialPort = ORSSerialPort(path: "/dev/cu.KeySerial1")
serialPort.baudRate = 4800
serialPort.open()
serialPort.sendData(someData) // someData is an NSData object
serialPort.close() // Later, when you're done with the port