adding a physical interface

Hi,

I’m about to build a simple physical interface (1 button) to trigger actions inside OF. My question is, did any of you do this before, and how did you do it?

Ideas i’ve had (to keep it low budget) is to deconstruct a mouse/keyboard and somehow attach the button to it or use an arduino board. To use the arduino board i need a way for OF to react in input from the board. Is there a (windows) lib for that?

thanks
/cj

I am happy to announce that we have just implemented serial support!

you can see it in the svn - we are working crazy hard on the next release which it will be in:

SVN

if you are anxious, you can download an earlier, but still working version of that code here:

ofSerial

in the zip, you will find a simple arduino sketch (you need an LED on pin 13 to see it) and a file called usage, which will give you some pointers about how to use it. You will need to know the serial port (ie, “COM…” on pc, “/dev/tty…” on a mac), but it should work pretty easily. There is a system for reading and sending data.

this is completely new code, and we look forward to hearing your feedback about how it works… I’ve tested it on pc and mac with an arduino board and it seems to work well on the machines I was on.


also, an alternative, for button interfaces is a device like this keyboard emulator:

http://www.ultimarc.com/ipac2.html

and although hacking a keyboard would be alot cheaper, I have found them super reliable for installation and quite easy to carry around.

hope that helps!

best,
zach

note that the ofSerial in the new release is an update of that…

can any arduino/rs232 heads let us know how the ofSerial code is working out for them? We don’t have alot of experience with that. For example, is the sample ok? You can find the arduino sketch in a folder called “others” and it should be pretty clear. Also, does the sample make sense in terms of multiple reads (the while loop?) / call and response, etc? Besides setup / read / write, do you need other functionality?

thanks!!
zach

hello zach

i’ll give it a go during the week as I am teaching at Hyperwerk.

I’ll try with “Firmata” a standard firmware developed by Hans Christoph Steiner that allowes full control of arduino via the usb port… it was originallt designed for PD but now has several other interfaces available

i’ll keep u posted

massimo

Update

I did the port… i’m 5 minutes away from making this work but my sketchy knowledge of c++ is giving me troubles :slight_smile:

A few notes on ofSerial:
* I think it should be a class so that it’s easier to support multiple interfaces ( the code looks cleaner too)
* at the moment is using the char type that is a signed type… (or so it seems) but Firmata uses, like midi, characters >= 128 to indicate commands and I think some of the data gets mangled
* there should be a couple of functions to just send and receive 1 byte from the port…we microcontroller people like this

zach if I send u the code can you give me some comments??
thanks!

massimo

sure, send the code along! happy to help

good point about the classes, object oriented is the way to go, especially to support multiple ports.

about char / unsigned char, you are totally right – I will look at changing it but seems to me no reason to user signed chars.

about 1 byte, sure, this is not a problem to add (and will just wrap the multi byte code)

thanks alot for testing it and feedback

take care,
zach

hey cj,

just a quick thought… if you need something quick and dirty, I’ve found that hacking a keyboard open can be a nice alternative to getting things communicating serially, especially if you are new to physical computing. That way the only programming you’ll need to do is to detect a keypress…

its cheesy, but it works.

http://5cameron.com/eid/tc/tc-2.php

have fun,

C

Hi massimo & zach,

How did it work out with the Firmata class? I’m really interested to use it if it came out nice.

/cj