From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting arduino to LED matrix/array

You need to change that from a constant on the block diagram to a control. Right click on the constant and choose Change to Control from the  pop-up menu.

 

Rounded Numbers 4 and 5 are not connected to anything inside the state machine so only three booleans can be checked. The 1 and 0 constants near the RndNmub VIs are only connected on the first instance. So the others will aways produce zeros.  Since you convert back to booleans inside the Initialize state, why not just generate the booleans in the subVIs?

 

The booleans need to be set before the play button is pressed. Otherwise the value of the array will be read before the user has time to select the buttons.  You probably need to re-think the logic and timing involved. The way it is currently written is not very user-friendly.

 

When a match is found, you need to do something other than Exit to do the scoring and re-try that you said you want.

 

For a program like this I would sit down with pencil and paper and make a comprehensive document which describes what must happen in each state and what criteria determine the next state.  Your description of how the game works is a good starting point. You need much more detail.  For example:

 

- User presses Play

- - Turn off all lights

- - Prompt user to guess

- - Wait for user to enter guess or start time limit for entry

- - Generate random data set

- - Write data to LEDs

- - - Compare data to user guesses

- - - Take action based on accuaracy of guesses.....

 

Lynn

Message 41 of 97
(1,229 Views)
Thanks I will try it out tomorrow, but could you possibly show me in an example.
0 Kudos
Message 42 of 97
(1,226 Views)
Can you help me work through this please?
0 Kudos
Message 43 of 97
(1,209 Views)
Can we work through this step by step together? Also you said something about you having made changes earlier which were and where?
0 Kudos
Message 44 of 97
(1,195 Views)

Round number 4 and 5 should be connected to something but i don't why they are not. How can I fix that?

0 Kudos
Message 45 of 97
(1,229 Views)

First figure out what they should be connected to then wire them up.

 

I cannot do it for you because I am not sure what you really want to do and I do not have the time to try to figure it out or guess.

 

Lynn

Message 46 of 97
(1,227 Views)

I fixed the random numbers problem. Now how can I fix my code?

0 Kudos
Message 47 of 97
(1,226 Views)

I just figure out the random numbers part in my new code i posted. Now what?

0 Kudos
Message 48 of 97
(1,224 Views)

You really need to put together a design for your program. The last piece of code you posted can freeze up under many combinations of button presses forcing an abort to end the program.

 

It still provides no feedback to the user.

 

It does not accurately display the results.

 

With 5 booleans to guess the probability of a correct guess is very low. This will frustrate players unless the rewards for a correct guess are very large.

 

The image below is a simplified starting point for a design.  A comprehensive design may require several of the boxes to be expanded into much more detail. For example Prompt for Guess includes displaying a prompt message (I would not use a dialog box, but that may be one of your requirements), setting the LED Display to blinking, and starting the timer. The flow chart shown does not include any provision for stopping the program. It does not handle errors (what happens if the Arduino gets unplugged while the program is running?). It does not show any of the timing, mostly because I have no idea of what you want the timing to do.

 

After you get a complete design document, then you begin to implement it in your program.

 

Lynn

 

Guess flow.png

Message 49 of 97
(1,206 Views)

thanks this is help. I want to timing to give the users 10-15 seconds to make there guesses. Do you have time where we can work through this piece by piece step by step?

0 Kudos
Message 50 of 97
(1,204 Views)