LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pwm - Sonar/Servo Area Detection

Hello,

 

In the process of developing an area detection, a stopping point has been hit. The included code is simply for pwm on a MyDAQ. The pulse wave is to drive a RC servo. Really where the dead stop has occured is that the pulse wave only drives the servo between 0 degrees and 90 degrees. I'm not sure why this is the case. The vi starts by using a shift register to move between 1 and 10. This is a back and forth process. This process is intended to develope the part of the pulse wave between 1ms and 2ms, which according to most data sheets will take care of moving the servo back and forth between 0 and 180 degrees. It is my understanding that the complete wave cycle must be around 20 ms. There is a for loop for adding 10 to the shift register, and determining if this is greater than the iteration of the for loop. If this evaluates as true the case structure builds and array for 180 degrees, and if false developes an array for 0 degress.  In all the waveform to my understanding follows the necessary process for devloping a PWM which would drive a servo.  Again, it only goes from 0 to 90 degrees.

 

Thanks for any helpful hints

0 Kudos
Message 1 of 2
(2,217 Views)

My recommendation would be to look over the below community example on how to output a PWM signal on your myDAQ hardware. The specific application is different, but the DAQ calls are the same. Rather than building a custom array and then continually writing the waveform, you should be able to set the duty cycle directly using the DAQmx Timing VIs and property nodes.

 

https://decibel.ni.com/content/docs/DOC-23438

0 Kudos
Message 2 of 2
(2,161 Views)