I have been delivered a motor controller that is arduino-based, but that I did not make. With it I have been given a list of commands to control the motor, for example:
"forward.x" - runs the motor forward by x steps
"stop" - stops the motor
and similar.
My task is to create an interface to control the motor in LabVIEW. I need to be able to create a button that I can press on the LabVIEW interface that will deliver a certain command to the arduino to trigger the corresponding action, i.e., a "FORWARD" button that will deliver the command "forward.1".
However, I am having difficulty understanding how I can deliver such a command to the arduino via LabVIEW. There are plenty of examples online for controlling individual pins, for reading/writing data and so on, but not for delivering commands to an already-installed sketch on the board. Is it just a case of a serial write of the command to the board?
If anyone has any idea where to start, I would really appreciate your help. Many thanks, Sam
I think that you first need to get an RS232 to UART converter to connect the Arduino to your computer.
You may also need a USB to RS232 converter if your PC does not already have an RS232 port.
As far as the LabVIEW software is involved, I think you are correct in thinking that you just need to send the command to the serial interface (assuming you have already set the baud rate first).
(It might even be possible to connect by USB, but I don't know how you would do that).
Thank you, the box as delivered has a converter to USB so I am fine on that count. I will press on with treating the commands as strings for serial write and see how I get on from there!
The final stage on that webpage is " Upload Labview Generated Arduino Code to Arduino Board", which is something smallen has said he doesn't want to do.
He has to preserve the motor control code on the Arduino.