LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino push button to LabView LED array

I am working on tictactoe game played using an arduino and viewed in LabView. 

Can i connect 3x3 button (Digital pins) to LED array on LabView?

0 Kudos
Message 1 of 15
(3,559 Views)

Yes, of course.

0 Kudos
Message 2 of 15
(3,555 Views)

Would you mind teaching me how to connect it? There's always an error whenever i try it,

0 Kudos
Message 3 of 15
(3,520 Views)

A sample would be this one (not my vi). I got this here:

 https://www.semanticscholar.org/paper/Implementation-of-Tic-Tac-Toe-Game-in-LabVIEW-Thota-Elsayeed/9...

How can i  connect 3x3 push button (arduino digital pins) to the LED array?

0 Kudos
Message 4 of 15
(3,515 Views)

Well, what kind of digital signal do you get from the push buttons? How are things connected? We really need much more information in order to help.

 

(If you have 9 digital inputs, you can just reshape them into a 3x3 2D array. )

 

On a side note, that VI is pretty bad, with blatant overuse of local variables. None are needed here. Also all subVIs are missing. (for some ideas, have a look at my old 4x4 tic tac toe that can play perfectly and knows the absolute best move for all possible positions. for 3x3, the problem is much simpler!)

0 Kudos
Message 5 of 15
(3,489 Views)

Indeed, what kind of hardware do you have available? How are things connected?

 

Depending on the push button array, you might not even need the Arduino and connect it directly to a NI-DAQ or NI-USB if you have these available.

If you don't have these, or if the push buttons require a special library, I would say your best bet is to communicate between Arduino and LabVIEW via the serial connection. You can create your own string format to pass data around between the two.

0 Kudos
Message 6 of 15
(3,481 Views)

"If you have 9 digital inputs, you can just reshape them into a 3x3 2D array."

How can i do this? (a sample vi would be much appreciated)

 

I have a tictactoe project using arduino and labview, it's suppose to be played using an arduino. The vi i showed which i got from here,  

https://www.semanticscholar.org/paper/Implementation-of-Tic-Tac-Toe-Game-in-LabVIEW-Thota-Elsayeed/9...

was only tictactoe game using labview. I want to play it using push buttons connected on arduino.

0 Kudos
Message 7 of 15
(3,474 Views)

What kind of hardware do you have (available)? Be a bit more specific please, so we know where to point you at.

As I understand your first post, your questions are: 1) how to detect which button is pressed (Arduino), and 2) how to get this information into LabVIEW.

 

The first one is a simple Arduino task. I assume you have a 3x3 keypad like this one. You can see from its documentation that it has six outputs: three for rows, three for columns. Ergo, you can make 2D coordinate like (row, column).

 

To send this data to LabVIEW, you can establish a serial connection. On your Arduino, you can format the input coordinates into a string (you can make up your own format here) and send this whenever a button is pressed. In your LabVIEW program, you can take these coordinates with the code you posted earlier.

0 Kudos
Message 8 of 15
(3,461 Views)

Sorry for very little information.

Actually i only have tact switches, arduino (and LED).

My questions are: Can i use tact switches to create an array? And how? (or if i can't use tact switches, what can i use? (anything with button) )

Or how can i connect tact switches to the LED array in the labview program i send earlier?

 

For my project i need to create a labview program (tictactoe game) and play it using arduino. Thank you very much for your response.

0 Kudos
Message 9 of 15
(3,455 Views)

@clown1239 wrote:

Actually i only have tact switches, arduino (and LED).

My questions are: Can i use tact switches to create an array? And how? (or if i can't use tact switches, what can i use? (anything with button) )

 


Yes, you can use tact switches on your Arduino. In this case, I would just connect 9 switches to 9 inputs on the Arduino. Simply check which button was pushed. You can number the buttons, where each button simply indicates one point in your Tic-tac-toe grid:

 

1 2 3
4 5 6
7 8 9

 

There are tutorials on how to use (tact) switches with Arduino: https://www.arduino.cc/en/Tutorial/Button

This is actually the first question I mentioned in my previous post.

 

 


@clown1239 wrote:

 

Or how can i connect tact switches to the LED array in the labview program i send earlier?

 


See my previous post. Once you can identify which button was pushed on the Arduino, you can send this data from the Arduino to LabVIEW over a serial connection. In your LabVIEW, open a serial connection to the Arduino. Each time a button is pressed, have the Arduino send the button number over this connection. Whenever the LabVIEW program receives this number, use this as input for the further code you sent. National Instruments has tutorials on how to work with serial communication in LabVIEW: http://www.ni.com/tutorial/2897/en/

 

Please look into the individual steps you need to make, and ask specific questions about them. That helps us to help you with  more precise answers.

0 Kudos
Message 10 of 15
(3,443 Views)