SEND_STRING Questions
jabramson
Posts: 106
I'm trying to wrap my head around some SEND_STRING commands...Not so much the commands themselves, but the string formatting.
For Instance, I have this command which works (SONY VISCA Camera Control)
SEND_STRING dvCamera, "$81,$01,$06,$01,$10,$10,$03,$02,$FF"
How is that different than let's say one of these commands (which don't work, so what am I sending?)
SEND_STRING dvCamera, "'$81,$01,$06,$01,$10,$10,$03,$02,$FF'"
SEND_STRING dvCamera, "$81$01$06$01$10$10$03$02$FF"
SEND_STRING dvCamera, '$81,$01,$06,$01,$10,$10,$03,$02,$FF'
Finally, I"d like to replace the $10s with a integer variable, how would I do that?
Thanks.
For Instance, I have this command which works (SONY VISCA Camera Control)
SEND_STRING dvCamera, "$81,$01,$06,$01,$10,$10,$03,$02,$FF"
How is that different than let's say one of these commands (which don't work, so what am I sending?)
SEND_STRING dvCamera, "'$81,$01,$06,$01,$10,$10,$03,$02,$FF'"
SEND_STRING dvCamera, "$81$01$06$01$10$10$03$02$FF"
SEND_STRING dvCamera, '$81,$01,$06,$01,$10,$10,$03,$02,$FF'
Finally, I"d like to replace the $10s with a integer variable, how would I do that?
Thanks.
0
Comments
The differences are the differences between a string expression and a string literal, the command which you note that works is a string expression which is a concatenation of integers and string literals and variables that resolve to integers. In the case above, all you have are integers designated by hex notation. You have no string literals or variables in the expression.
The first of the examples which you list as not working is a string expression (delimitted with double quotes) containing nothing but a single string literal (delimitted with single quotes). The second doesn't work because you don't have commas between the integers that you want to send and you are probably just sending a single 8bit integer, The last is a single string literal. It includes the $ characters and the commas.
The classic example in demonstrating how this works. All of the following will send the string 'HELLO'
The final hello shows how to include a variable in a string expression.