Showing results for 
Search instead for 
Did you mean: 

myRIO LED Brightness

Go to solution

Hello all,

I have made a way to control not only the brightness of the onboard myRIO LEDs, but to control their brightness using PWM as well.

I have attached the FPGA VI for the myRIO- it might need to be compiled.

Suggestions are welcome!

0 Kudos
Message 1 of 4
Accepted by topic author Shlok1229

I think your VI could be significantly simplified! I guess this was a learning exercise for you and you're looking for some feedback?


1) You can remove the local variables (which use up FPGA fabric) and just wire the brightness control to the Wait(uSec) directly - branch the wire into each one.

2) Having a 'stop' button on FPGA code doesn't really make any would always want the code to continue running...otherwise you would need to reset the FPGA (which is in contrast to programming in windows where you always want to stop the loop gracefully rather than aborting it - remember that an FPGA is essentially an electronic circuit when compiled)

3) Why do you have the additional sequences with a 1uSec wait in? You could just have "turn on" -> "wait" -> "turn off" -> "wait".

4) Having 4 loops for dimming some LEDs seems like unnecessarily repeated code...if you wanted to get really clever I'm sure you could simplify the code down to a single loop!

Message 2 of 4

Hi Sam, 

Thanks for giving a detailed reply to my post.

I have implemented two of your suggestions- #1 and #3.

But I didn't understand #2 and #4.

By "Having a 'stop' button on FPGA code doesn't really make any would always want the code to continue running..." do you mean that I should directly close the window without stopping it?

Can you please elaborate on what to do?




0 Kudos
Message 3 of 4
The code runs on an FPGA - it doesn't have a user interface. Except in the situation where you run it in interactive mode, you wouldn't be able to press the 'stop' button - except by an FPGA I/O node from your RT/PC software. When designing code for an FPGA, you would usually want it to run forever when loaded to the FPGA - once stopped, you'd have to reset the FPGA to start the code again. FPGA is one of the few situations where you can wire a false constant to the while loop.

As for #4 - you currently have 4 loops with 4 sets of repeated code. What if you decided you wanted to dim 8 or more LEDs? Would you copy+paste the code another 8 times? You will soon run out of space on the FPGA. By getting clever with the loops/logic - you should be able to find a way to control the brightness of any number of LEDs with a single loop - this will save you space on the FPGA and allow you to expand/scale your code.
0 Kudos
Message 4 of 4