For those of you using LabVIEW MakerHub LINX to control your microcontroller with LabVIEW, there is a way to implement some Arduino code and libraries and add extra functionality to your project. LINX supports “custom commands” where you can implement a custom function to do pretty much anything you want that isn’t supported directly in LINX. In my Instructable, I go over an example of writing a custom command for the PmodCLP which uses parallel data interface (basically writes digital channels high or low quickly). Because LINX only has a loop rate of about 200Hz, it is too slow to directly control the PmodCLP. Thus the need for a custom command!
To add a custom command, you’ll need the Arduino IDE or MPIDE so that you can edit the LINX firmware to add your custom command. This involves creating a function that passes in an input array from LabVIEW, the number of bytes of the input, a response array, and the number of bytes the response is. The response will contain the information that you send back to LabVIEW. For more information on how exactly to write the custom command, check out the instructable linked above. Once you’re done editing the code, upload the firmware to your board.
In LabVIEW, you can access the custom command VI by going to Functions Palette->MakerHub->LINX->Utilities->Custom Command to call the custom function. In the custom command VI, you will have the input which is a byte array containing the information that you are sending to the custom command (the input array mentioned earlier). You’ll also need to feed in the number you assigned your custom command (you can have up to 16). A picture of how to use the custom command VI is below. The VI executes the custom command that you wrote and returns the information that you told it to.
Custom commands can be used for Arduino libraries as well! I wrote a custom command for the DHT11 humidity and temperature sensor using an existing Arduino library that reads information from the sensor each time the custom command is called. Try using custom commands for anything that can’t be done natively in LINX.