LabVIEW Interface For Arduino on Leonardo

7/17/2014 Update from Sam K:

Hey everyone.

LIFA has been replaced with LINX which includes support for the Leonardo (and lots of other new features too!). Check it LINX here:

Let us know if you have any questions about LINX by posting in the LabVIEW Hacker forums here: Thanks! Sam K LIFA & LINX Developer

Original 2013 Post

I've seen a lot of neat projects using the LabVIEW interface for Arduino (LIFA). It's a quick way to communicate with an Arduino, build a nice GUI for prototyping or testing sensors, and integrate it into a larger system (the Waterloo Labs Science Fair Mashup is a great example).  It's also pretty cheap to try ($50 for LV SE + Arduino Uno). Recently I ran into a bit of a hiccup in trying to use LIFA with a newer Arduino Leonardo to graph some sensor data.  Reading the forums, I found others who ran into the same two problems:

  1. The AFMotor library used by LIFA does not yet support Leonardo
  2. The Leonardo USB-Serial interface may not be recognized in VISA

For others who run into these issues, here are a few quick workarounds: For #1, simply contribute a patch to the AFMotor library to add Leonardo support.  Alternatively, you can remove the AFMotor and Servo libraries from the Arduino project (assuming you don't need motor control).  This is done by clicking the down arrow on the right of the tab bar in the Arduino IDE, and deleting these files from the project.  The last step here is to comment out "#DEFINE STEPPER_SUPPORT 1" in LabVIEWInterface.h.  This will prevent compilation errors due to missing servo libraries (thanks for including that Sam!).


As for the VISA issues, I had no success debugging the issue with VISA 4.6.  The USB-serial resource was detected, but listed as 'incomplete'.  Fortunately, updating to NI-VISA 5.1.2 solved this problem. With those two changes, I was able to compile and upload the LIFA firmware, and communicate with the Leonardo from a LabVIEW VI.  The only caveat (besides losing motor support) - some of the IO definitions listed in LIFA VI comments do not apply to Leonardo.  For example - Leonardo I2C (aka 'Wire') IO are on pins 2/3, not on A4/A5 as on the Uno.  Here's a photo of using the Leonardo I2C interface from LabVIEW via Sam's BlinkM Example: