cancel
Showing results for 
Search instead for 
Did you mean: 

Slow digital write to Arduino (PWM)

DESERT RACE
Member

Slow digital write to Arduino (PWM)

Message contains an attachment

Hello Everyone,

I have the following VI. I am using nested loops. One to generate waveform and the second one to iterate through the array of obtained waveform samples and generate my owm PWM on the arduino.

Everything works with one problem. As you can see from the VI I am writing digital values to the arduino inside the second loop and it turns out to be slow. Like even if I set loop delay to 0 the write to arduino slows down everything. This is the first time I am using the toolkit and would like to know if there are ways of speeding up the write procedure to arduino.

Appreciate any input/help with this.

DR

2 REPLIES 2
Nathan_B.
Active Participant

Re: Slow digital write to Arduino (PWM)

Serial communication is relatively extremely slow!  The only method that I would suggest to do PWM is to use the native PWM function on the Arduino.

Highlighted
DESERT RACE
Member

Re: Slow digital write to Arduino (PWM)

I came to the same conclusion after disconnecting the generated PWM from the digital input of the arduino interface and using a constant integer instead. This also slowed down the loop execution a lot. Only when the write to serial function is not present the loops runs fine.