LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Servos and HC-SR04 in one code (arduino)

Solved!
Go to solution

Hi guys,

 

How can we use both servos and HC-sr04 in the same code? 

I am in a catch 22 situation where I cannot use both of them as LINX supports the HC-SR04 but not servos, LIFA supports servos but not the HC-SR04.

I'm stuggling to make a pulseIn subVI for this.

Is there any solution for this?

0 Kudos
Message 1 of 4
(3,235 Views)

As far as I remember, I think you can modify/customise the default Arduino sketch to build in your own custom commands - https://www.labviewmakerhub.com/doku.php?id=learn:tutorials:libraries:linx:misc:adding_custom_comman...


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 4
(3,227 Views)

Thanks Sam, 

 

I am not an expert in LabVIEW, so is there any simpler way to do it? 

Like can we modify subVIs?

0 Kudos
Message 3 of 4
(3,211 Views)
Solution
Accepted by topic author Shlok1229

That is the simplest way to do it! Actually, the hard part is writing the Arduino code for the custom command. From the link I sent you, there is a SubVI that already exists to call the custom command you have defined.

 

The Arduino toolkits both work in the same way - you run a pre-compiled firmware on the Arduino which does the hardware interfacing and it talks to LabVIEW using a Serial Protocol. The toolkit means you don't need to write any LabVIEW code for the serial protocol, nor do you need to write the Arduino Sketch yourself. The fact that you can modify the sketch to add in custom commands is a pretty powerful feature and saves you having to write your own sketch (or LabVIEW code) from scratch!


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 4
(3,204 Views)