LabVIEW Interface for Arduino Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Example Arduino: read analog inputs Joystick + serial interface to LabVIEW

Description

This article presents a procedure for reading the analog ports of Arduino UNO R3 board , on which a Joystick shield was installed. The analog data are related to the position of command and can be monitored from the front panel of our program , for which we use serial communication.

More information on the shield for Arduino https://www.sparkfun.com/products/9760

1.jpg

Procedure

First we note that the shield will work with Joystick , The position of the lever mounted on the arduino shield is calculated from the two potentiometers in the joystick . The joystick can be moved in two dimensions typically represent the X and Y. To read the potentiometers that use the analogRead () function returns a number between 0 and 1023 ( the X position is read from analog pin 0 and the Y position is read from analog pin 1) .

May be helpful to use the value of the X and Y position to determine if the joystick is centered or move to one of the 8 directions (ie , up, right , up, right, right , down, down , left, down , left, left - top) . Since we know the value of each dimension will be between 0 and 1023 could expect the central value to be around 511 or 512 , but because the joysticks are analog devices is unlikely to be accurate than the actual value. To solve this problem , we specify two values ​​"threshold" and believe that any value within this range should be considered " center" , then the program is downloaded to the Arduino :

6.png

We will make a program in LabVIEW to test and verify the correct operation of our program in the Arduino , we will make the reading of data transmitted by the Arduino from the serial port on the card installed , proceed to read the COM port and under I received command will activate an LED for each position of the joystick, then a fragment of code

7.png

Download All
Comments
midogawad
Member
Member
on

hi great tutorial.

what if i want to read 5 diffrent readings at the same time and enter multiple variables to the arduino

maejoh
Member
Member
on

Possibly a silly question. What is the point of the arduino serial reader sketch file, as it relates to using the arduino in lab view? Do you have to have that running at the same time? Do you have to have a specific file written and saved in a certain place to tell labview to use it?

Contributors