1 person found this helpful
(If you haven't already, download the LR 5 SDK, which includes complete documentation.)
There are a few documented mechanisms for LR plugins to send data to external programs:
- The LrHTTP module lets plugins invoke URLs with GET or POST commands. Your external program could implement a local HTTP server to receive those GETs and POSTs from your LR plugin.
- Your LR plugin could write to a log a file, which your external program could poll continuously for changes. While this might offend those with more delicate architectural sensibilities, with a little tuning you can make this pretty responsive without costing too much in CPU.
- Your plugin could invoke an external program via LrTasks. If the external program is reasonably lightweight, you can do this perhaps several times a second without consuming excessive CPU.
For receiving data into your LR plugin from an external program:
- Your plugin can establish a URLHandler that will receive HTTP requests to "lightroom://" URLs made from local programs on your computer.
- The plugin can poll the external program using LrHTTP using GET and POST commands. The external program only responds when it has data to send, so the CPU overhead is low.
- Your plugin could poll a log file written by the external program. I haven't tried this direction, but it might be harder to tune such polling in this direction, given the limited capabilities of the LR SDK.
Also, there is an undocument SDK module LrRemoteCommunication that appears to set up a simple two-way pipe with an external program, but no one has posted here how to use it.
If you are just prototyping, the easiest way might be to use separate layer for MIDI, since there is also easy solutions for using MIDI data on Arduino. Several MIDI plugins and solutions exist for Lightroom, so you don't even need any Lua development skiils.
Actually, while making LR module with Lua, you may use funcitons from io package, such as open a file and write to it.
Try it out - may be there is a way to associate file with a serial port and write into it, so Arduino catches these submissions and react as you want?
LR 6 added LrSocket, which provides Unix-like sockets for communicating with local processes.