04-28-2012 01:04 PM
Is there a quick workaround for using Arduino mega 2560 with Labview other than the LIFA that requres labview 2009+? The arduino is programmed to control display of images on an OLED screen. I want to use Labview simply to trigger/start the arduino program.
We have Labview 8.6 running several equipment in our lab already, so using a trial version or an upgrade is not easily feasible.
04-29-2012 10:34 PM
LIFA is simply a gathering of custom functions for running commands on Arduino via the custom LIFA firmware that you install on Arduino. It sounds like you have working code on the Arduino already and you probably don't want to recode it all in LabVIEW.
So, it sounds like LIFA is probably not something you actually want since you already have everything programmed on the Arduino (right?). You need simply to send a packet via serial from LabVIEW using VISA and on the Arduino simply read from serial if there is anything available in the buffer. So, when you receive the command (you will want uniquely identify it) you will just execute the function on the arduino that triggers the Arduino program.
04-29-2012 11:01 PM
Yes thats sounds like exactly what I want to do. I have a working Arduino code, I just want to trigger the program from LabView. Can you recommend some references that might give me an idea of how to implement this? Thanks!
04-30-2012 02:19 AM
If you were able to get LIFA on one computer and look at how LIFA sends a particular command then you could disect it and make a working version of the code you want. After you have it working (without any native LIFA code; meaning you have to breaking everything down or make your own equivalent functions), you can save them for LabVIEW 8.x and then use them on the computer that are still on version 8.6.
Good Luck.
04-30-2012 05:16 PM
Since you already have the Arduino app, it might be easier for you to add some communications to it and build your own VI to manage the LabVIEW to Arduino communications. This is not a LIFA solution but the way we did it before LIFA came along. BTW, thanx to NI for this handy tool!
Using the Arduino Core software, try uploading the Arduin example app
Sketchbook/Examples/Communications/SerialCallResponseASCIIT
and connect to the board with the Arduino Serial Monitor. You'll see the app start by itself and it will repeat sending "0,0,0" until you send a character to Arduino from the Serial Monitor. It will answer back with the voltages on analog input 0 and 1, then the value of digital pin 2. Send another character, it'll send another reading. Close the Arduino serial monitor.
In LabVIEW, load the "Advanced Serial Write and Read.vi" from the NI Example Finder. Set the VISA resource to the COM port used by the Arduino Core. Leave all the other controls at their default values. Run this VI and you should see the same data displayed as before.
Now you should be able to incorporate code from the Arduino example into your Arduino app to send and receive the messages that you need from LabVIEW. Arduino checks for a message from LabVIEW at the beginning of each pass thru the loop(). If you want to answer back, then just modify the Serial.print statements to suit your needs.
Use the Advanced Serial Write and Read.vi as it is or use it as a starting point for a VI that will send and receive your specific messages.
Some things to watch out for:
Hope this works for you.
JohnCS.
05-01-2012 10:20 AM
Yup, it worked out nicely. Thanks John!