09-10-2016 02:52 PM
i need to send an array of angles with some litters as a group to the serial port which function that can do this ? as considerd that the visa wrrite accepts only string input .
09-10-2016 03:01 PM
@MuhammadAshry wrote:i need to send an array of angles with some litters as a group to the serial port which function that can do this ? as considerd that the visa wrrite accepts only string input .
I hope you want to send letters and not litters 🙂 Anyway, as you have noted, you can only send string using VISA Write. Same for VISA Read, you get string. The solution is very simple: use the string-number conversion functions (Number/String conversion subpalette). For example you have an "angle" numerical value, you need to convert this into a string, and send it. On the receiver side, you can convert the string back to number if needed:
09-10-2016 03:30 PM - edited 09-10-2016 03:33 PM
it works only with an "number" not an array of numbers aslo i need to send something like that "WO " Before the array and then the array . is "Build Text" function works ?
09-10-2016 03:44 PM
09-10-2016 07:22 PM
Is there a specific format for your string? If you know the format and the types of inputs (for example, a string, a float, and an integer), you can use "Format into String" which has a specified format (for example, %2s %4.1f %4d means "two character string, space, 4 character number format xx.x, space, 4 digit integer"). The function will help you build the Format String (right-click the function, type ^H and read the Help text).
Bob Schor
09-11-2016 08:12 AM
Thanks for ur effort
actually i have 6 servo motors that i need to send their angles to arduino serial port with that format "WO Xangle1 YAngle2 Zangle3" and so on for the 6 motors .
09-11-2016 06:48 PM
A FOR loop might help you to build up all of the strings and then send them all at once after the loop is complete. Of course, this assumes you have an array for the data of the servos.