LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Arduino LED intensity

Hi,

I have got my Arduino uno interfaced with Labview. As part of my project one of the task is to control the brightness of an actual LED using a Gaussian curve. The intensity should gradually increase and follow the gaussian curve. Led is connected to one of the PWM pins of arduino. I have got the code and it seems fine to me but I am not getting any output on the actual LED (all connections are fine). Just for the experiment I have tried the same technique using sine wave generator that works fine and LED follows the behavior of sine waveform.

I have attached both VIs (sine and gaussian). If I am following the wrong appraoch please rectify

I will be grateful if someone can help.

Thanks

Download All
0 Kudos
Message 1 of 6
(4,408 Views)
  • The Arduino Uno requires a baudrate of 115200
  • The 'Set Pin Mode' subVI should not be inside the loop, you only need to set it as an output once.
  • It's only possible to write a single value (scalar) to the Arduino with a single LIFA function.  You are trying to write a non-scalar to the Arduino (this doesn't work, it's only writing a single value).
  • It only appears to work for the sine wave because you are seeing aliasing (you aren't seeing the actual sine wave, you are seeing one point for every 1000 points of the sine wave and that one point has a slightly different amplitude than the last.
  • The range of PWM values (for that subVI) is 0 to 255 where 0 is 0% duty cycle and 255 is 100% duty cycle.  So, if you want your LED to get fully bright at some point, you need to scale your output values to the 0 to 255 range.
  • You haven't given very many details about what you need (how fast do you need to write the values?  Do you just want it to cycle on and off? etc.)

  • Lastly, I highly recommend you upgrade to LINX (available via VIPM).  LIFA is no longer updated or officially supported and LINX is actually faster.
0 Kudos
Message 2 of 6
(3,441 Views)

Hi, 

Firsrly, thanks for your reply. 

- I have changed the baude rate to 9600 in Lifa as i was also using Bluetooth interface that required baude rate to be 9600.

- In terms of speed I just want it to complete a cycle. Maybe later on I can use delay or wait for timing if required.

- Like you said to "scaling" the output. How would I be able to do that? Some guidance would be beneficial.

And I'll put the "set pin" outside the while loop

Thanks for your help

Kind Regards

0 Kudos
Message 3 of 6
(3,441 Views)

Thank at all

José Mª. Gómez de Salazar

Catedrático del Dpto. de C. de Materiales. (F. CC. Químicas)

Universidad Complutense de Madrid

tfno: 34913944351//34616497711

FAX. 34913944357

URL: www.ucm.es/info/tuma

2015-03-19 11:25 GMT+01:00 w1 <web.community@ni.com>:

Community

<https://decibel.ni.com/content/index.jspa> Re: Labview Arduino LED

intensity created by w1 <https://decibel.ni.com/content/people/w1> in *LabVIEW

Interface for Arduino* - View the full discussion

<https://decibel.ni.com/content/message/96328#96328>

0 Kudos
Message 4 of 6
(3,441 Views)

Basically you need to get your output into a ratio of the largest value (essentially a percentage of your largest value).  So, you will have a value between 0 and 1.  Then you simply multiply by the target range of 255.

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

Hi Nathan,

I have tried making an array with some help but I am not sure if I am

implementing it the right way or not. Can You please have a look on the

attached VI?

Kind Regards

0 Kudos
Message 6 of 6
(3,442 Views)