LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lab View interface for arduino

Solved!
Go to solution

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


0 Kudos
Message 1 of 13
(7,086 Views)
Solution
Accepted by topic author Raj_Piyare

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

Jamie S.

Applications Engineer
National Instruments
Message 2 of 13
(7,058 Views)

Thanks Jamie

0 Kudos
Message 3 of 13
(7,008 Views)

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

 

0 Kudos
Message 4 of 13
(6,996 Views)

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

Jamie S.

Applications Engineer
National Instruments
0 Kudos
Message 5 of 13
(6,974 Views)

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?

0 Kudos
Message 6 of 13
(6,543 Views)

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,

Daniel Dorroh
National Instruments
0 Kudos
Message 7 of 13
(6,521 Views)

hello everyone!

 i want to control a dc motor using gyroscope, is it possible to do it using LIfA??

0 Kudos
Message 8 of 13
(6,163 Views)

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!

dK
0 Kudos
Message 9 of 13
(6,126 Views)

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...

0 Kudos
Message 10 of 13
(5,886 Views)