ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM and DC Brushless

Hi all,

I wanted to create a pwm signal from my arduino mega 2560 to my DC brushless by using the attached code but something goes wrong, I kept getting error message from labview.

Please help me if anyone knows the solution.

Thank you!

Regards,

Loo

Download All
0 Kudos
Message 1 of 6
(4,721 Views)

I claim you need two "digital write" sub vis in your block diagram.  One "digtal write" to write the pin direction information.  A second "digital write" to wtrite the PWM siganl to the pin .  Try this modification and let us know if it works.

hrh1818

0 Kudos
Message 2 of 6
(3,646 Views)

What error messages are you getting?  What are you using for a motor controller?

Tip:  Never use the "Set Digital Pin Mode.vi" inside of a repeating loop (unless you are changing the mode mid-execution), it will just slow down the Arduino.  Put it outside of the loop after "Init.vi".

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

My comment about needing two digital write sub VIs is bad advice.  I need a lot more time to come up with a better solution  Most llkely others will beat me to a solution.

hrh1818

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

Attached is a version of your PWM that works.   Two comments:

One.  In this version Run the VI, Enter a PWM value and then click on Send.  Repeat the Enter a PWM value and Send sequence as manry times as required.  Click on Stop to quit.

Two.  This version was modifeid to work with COM port 3 on my computer.  You may  need to change the COM port to work with your computer.

hrh1818

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

thanks guys for your suggestions.

I am using ESP for the speed control

everything is ok when I put "Set digital pin mode" outside the loop!

Cheers,

Loo

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