The simple arduino interface was added in XTension build 389.
The Arduino driver uses a simple text protocol to talk to get data from and control the ever more popular PIC and Arduino community. I personally use a lot of these things and love them. I have code for the arduino side for parsing responses and will clean that up and post it shortly.
All lines from the arduino must be cr terminated. So as your last print statement use a println();
Any command line without an “=” in it will be treated as a log item and will show up as a log line in the XTension log.
further commands are in the format of theAddress=theValue(13)
supported values for theValue are the text “on” or “off” which cause a non-dimmable unit in XTension to just turn on or off or a float or integer number. The Address value must have a corresponding unit in XTension with that exact string (non-case sensitive) as the units address. It will then receive the data as sent.
for example to turn a unit on you might send from your arduino something like:
to send a valid line to XTension. For numerical values make sure that dimmable is turned on for the unit in XTension and send something like:
float MyValue = 45.5;
As of build 842 it is possible to send non-numerical data to a unit in XTension too. If you send unitAddress=some string of not numbers then the value there will go instead into the description of the unit. You can then trap it for further processing by creating a handler in the ON script of the named unit like:
on descriptionChanged( newDescription)
and then the new description will be passed to you to do with whatever you choose.
If you do not wish to have XTension send you have local changes from the interface make sure to mark the units there as receive only. If you wish to have control in your arduino from XTension to parse the commands you can undertake to parse those simple commands yourself which is not difficult or send me a note asking me to finalize the arduino example code and get it uploaded to this page.
As a potential gotcha to keep in mind, XTension's address parameters will always be sent in uppercase, even if you created the units with lower case addresses. So keep that in mind when you're writing your Arduino compare code for the incoming address/command.
Arduino's connected via USB/Serial interfaces are supported as well as via xBee radios or TCP interfaces.
I've posted a long winded description of building some remote controlled PWM dimmable LED strip lighting in my sons aquarium over on the blog. Along with the arduino code necessary to do the communication with XTension. arduino, xBee and pwm lighting with XTension
In plugin version 3.2 in XTension version 9.5.1 a sendRaw command was added to send arbitrary strings to the arduino device. This does not append a carriage return at the end so if you need this you’ll have to add it in the script as shown below. This is implemented only for the individual Arduino plugins and not for the native support for this embedded into the xBee interface. If you need that please let me know and I will move implementing it there up the list of priorities.
tell xInterface “your arduino interface name” to sendRaw( “this will just be sent”)
but without the carriage return that will probably be needed to parse it out on the arduino side. It is possible to add that via applescript somethign like:
tell xInterface “your arduino interface name” to sendRaw( “my string” & ascii character 13)
if you place the interface in debug mode it will write to the log any raw data being sent, otherwise this command generates no logging when not in debug mode.