Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

C# Sdk Tutorial 52 Get Variable Question

Assistance Requested

Help JustinRatliff with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

JustinRatliff claims to have checked these sources:
 
#1

I'm using the C# SDK Tutorial 52 Get Variable to test communications with my app EZ-Face. The code below shows how to send or set a variable "X" and Get "X". I understand Set "X"

Code:



private void btnSetX_Click(object sender, EventArgs e) {

sendCommand(string.Format("$FaceName = {0}", tbX.Text));
}

private void btnGetX_Click(object sender, EventArgs e) {

sendCommand("print($x)");
}



What I am wondering about is how could I use the GetX event "Print($x)" to take that variable from EZ-Builder and set it as a variable in C# or even display it in a text box?

Thank you!

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

Edit. Deleted my answer which was apparently either wrong or I mis- interpreted the question so as not to confuse later readers of the thread.

Alan

#3

Here's the updated project that will help you: Tutorial52-EZ-BuilderScriptInterfaceClient.zip

To clarify, I have modified sendCommand() to now return the response string.

Code:


private string sendCommand(string cmd) {

try {

Log("Sending: {0}", cmd);

clearInputBuffer();

_tcpClient.Client.Send(System.Text.Encoding.ASCII.GetBytes(cmd + Environment.NewLine));

return readResponseLine();
} catch (Exception ex) {

Log("Command Error: {0}", ex);

disconnect();
}

return string.Empty;
}




So now your Get X looks like this...

Code:


private void btnGetX_Click(object sender, EventArgs e) {

string retVal = sendCommand("print($x)");

Log(retVal);
}

#4

@DJSure - Thank you Thank you! Grin

That is exactly what I was hoping for and trying to do. I had tried something similar to "string retVal = sendCommand("print($x)"Winky;" for the get button but was on the wrong path trying change how the private void Log function worked.

#5

@thetechguru - Thanks Alan - I knew you were trying to help, but I did get the sense you may not have understand my question originally.
Smile I appreciate you trying to help.

#6

Is it possable to make your robot atonoumous if you use the non proggramer application because I heard C++ is only for people that have a lot of experience in programming

#7

Society, this section of the message board that you replied too is for programmers. The rest of the forum is for non programmers. This question topic is regarding programming the EZ-SDK for custom interface, etc.

What you're asking for is within the EZ-Builder (non programmers) software. Smile yes, it does everything including autonomous navigation by detecting objects in it's way with the radar controls.