Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling myRIO LEDs with Keyboard Inputs

The attached code works if I'm trying to light up LEDs from the Boolean Pallate on the front panel. However, when I try the code with the myRIO LEDs, I get no response. 

Any ideas for how I can get this to work? Also, is it possible to use numeric keypad inputs (ie, pressing a 1, 2, etc.)?

 

Press ctrl+e to see block diagram.

0 Kudos
Message 1 of 6
(5,280 Views)

@richardj1701 wrote:

The attached code works if I'm trying to light up LEDs from the Boolean Pallate on the front panel. However, when I try the code with the myRIO LEDs, I get no response. 

Any ideas for how I can get this to work? Also, is it possible to use numeric keypad inputs (ie, pressing a 1, 2, etc.)?

 

Press ctrl+e to see block diagram.


Hi,

     When ever you try to run a code using an hardware place a while loop to get real time response for the code. in your code you haven't placed a loop so when you run the code naturally it run once , either it waits for 1st user input or the timeout which ever occurs first. 

 

Refer to this example on how to program. https://www.youtube.com/watch?v=SHJ-vu4jorU

 

 

Kudos Welcome 🙂

 

Certified-LabVIEW-Associate-Dev_rgb (1).jpg

Certified LabVIEW Developer
Best LabVIEW Programmer @NIDAYS 2015
0 Kudos
Message 2 of 6
(5,260 Views)

Hi SanthoshJoel,

 

Thanks for the reply! Unfortunately, this does not contribute to a solution. In the original code that I attached, the event structure is set to never time out by default (since I haven't specificed a wait time). Upon establishment of a while loop that encases the original code, it seems as though we never enter the event structure since pressing the specified keys don't yield any responses. 

 

- Richard

0 Kudos
Message 3 of 6
(5,251 Views)

Richard,

 

Ensure the front panel is selected when you make any keypresses. I have had no trouble getting it to respond to keypresses in a while loop, though I realize this is secondary to your issue. I would like to clarify my understanding. It sounds like when you wire boolean indicators to the button presses, they light up as you expect. When you wire the myRIO VI to them, you don't see the LEDs light as you would expect.

 

Could you open the myRIO VI by double-clicking it, click the tab called "View Code" and post a screenshot?

 

 

Austin
Staff Software Engineer
NI
0 Kudos
Message 4 of 6
(5,243 Views)

Hi yea_likethecity,

 

Your understanding is spot on. Below is a screen shot of what I'm working with.

 

I've made sure that I was on the front panel before pressing any keys but, still, none of the onboard LEDS would light up.

 

Thanks,

Richard

 

 

0 Kudos
Message 5 of 6
(5,231 Views)

@richardj1701 wrote:

Hi SanthoshJoel,

 

Thanks for the reply! Unfortunately, this does not contribute to a solution. In the original code that I attached, the event structure is set to never time out by default (since I haven't specificed a wait time). Upon establishment of a while loop that encases the original code, it seems as though we never enter the event structure since pressing the specified keys don't yield any responses. 

 

- Richard


Hi Richard,

                  Let me answer your questions.

 

Unfortunately, this does not contribute to a solution. In the original code that I attached, the event structure is set to never time out by default

You have set the event time out to default, so what happens it when ever you press a key the code run once and will stop. so if you want you want a output that glows an LED when ever a key is pressed you should have a loop/

Upon establishment of a while loop that encases the original code, it seems as though we never enter the event structure since pressing the specified keys don't yield any responses. 

Its a basic programming fact that whenever you place a event structure inside a while loop you should create a case for exit button. If you dont create a value change for the exit button (as you did in your code placing it outside event) your Vi wont stop. 

Also connect a timeout value of 10 to event structure.

 

And regarding the issue you are facing just check with the Myrio getting started wizard and check the LED's Are working properly.

 

The same code works fine here.

 

Certified-LabVIEW-Associate-Dev_rgb (1).jpg

Certified LabVIEW Developer
Best LabVIEW Programmer @NIDAYS 2015
0 Kudos
Message 6 of 6
(5,225 Views)