09-22-2011 08:47 PM
Hi
I want to control the digital ports of my arduino using LIFA.
Can anyone advise me how can i switch on and off digital ports using a switch in labview. For eg, when i click on the switch on the front panel, port 12 should turn on and vise versa.
I am able to read from anlogue pins but not able to write to digital pins.
Please help.
Thanks
Rajeev
Solved! Go to Solution.
09-23-2011 04:00 AM - edited 09-23-2011 04:09 AM
Hi Rajeev,
I'm Jamie an Applications Engineer at NI UK.
I have a written a sample piece of code on how to write to a digital pin based on the status of a toggle switch on the VI front panel, the VI snippet is attached, just drag the PNG image into a new labview Block Diagram VI to load it and arrange the Front Panel appropriately.
Hopefully this will help your project and let me know if I can help you any further.
Thanks
Jamie
09-25-2011 04:58 PM
Thanks Jamie
09-25-2011 06:15 PM
Thanks for the reply.
Could you also advise me how to control multiple pins but individually eg, pin 10, 11,12.
I should be able to turn each of them on or off at a time.
Thanks once again.
Raj
09-26-2011 03:45 AM
Hi Raj,
Glad I could help, the following VI setup will achieve individual pin control:
Front Panel Setup:
In order to write to multiple digital pins with switches you can create an array of toggle switches on the "Front Panel" by placing down a simple "Array" control and then dragging a "Toggle Switch" control within the array structure and extending it to the required size using the resize tools, i.e.. to control arduino pins 0 through to 7 drag the array to reveal 8 toggle switches.
Block Diagram Setup:
Outside a while loop you can then individually initialise each required Arduino pin as an output using a "Set Digital Pin" VI, e.g. you can use 8 "Set Digital Pin" VI's in sequence setting each pin 0 through to 7 as an output.
Within the "While Loop" structure place the block corresponding to the switch array along with a Arduino "Digital Write Port" VI connecting the output of the array to the "Pin Values" input of the "Digital Write Port" VI (this will result in the toggle switch statuses being outputted to the digital pins).
Finally place the Arduino "Init" and "Close" VI's along with a "Simple Error Handler" VI outside the "While Loop" structure and wire in the same way as in the code snippet I posted previously ensuring that the loop condition is also wired to a stop button in the same way as the code snippet.
This method does not require a True/False case structure.
Hope this helps with your application Raj, let me know how you get on and if you require any more assistance when using the Arduino VI's.
Thanks
Jamie
08-27-2012 06:21 PM
Hi everyone I am trying this path
C:\Program Files (x86)\National Instruments\LabVIEW 2012\vi.lib\LabVIEW Interface for Arduino
and the firmware folder isn't there so I can't find the firmware I need to start using labview with arduino, I followed all the steps, I installed labview (trial version in this case), the visa drivers, the software of arduino that I installed prevously (actually I am programming with the arduino language), and finally I installed the VI Package Manager, I installed the arduino interface but I just can't find the firmware, anyone can help me?
08-28-2012
08:32 AM
- last edited on
04-27-2025
11:43 AM
by
Content Cleaner
Hi gmlimon,
I just installed the LabVIEW Interface for Arduino on my computer, and was able to find the directory you are looking for at C:\Program Files (x86)\National Instruments\LabVIEW 2012\vi.lib\LabVIEW Interface for Arduino. This sounds like an error in installation.
Installing the toolkit should create the directory you specified above.
Warm Regards,
03-17-2013 12:35 PM
hello everyone!
i want to control a dc motor using gyroscope, is it possible to do it using LIfA??
03-18-2013 06:07 PM
I have not done it personally, but you should be able to. If you do happen to run into any issues, or have any questions, just let us know!
05-15-2013 12:05 PM
Hi everyone...Can everyone help me...
i want to switch on and off my toggle switch using labview and arduino...
my case is same with Raj_Piyare...
But my problem is i dont knw how to read from anlogue pins...
can anyone give me simple code...???maybe a complete code for same code like Raj_Piyare's case...
i'm really2 need it now...