Asked — Edited
Resolved Resolved by DJ Sures!

C# Sdk Tutorial 52 Get Variable Question

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"



    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 ARC and set it as a variable in C# or even display it in a text box?

Thank you!


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

#1  

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

PRO
Synthiam
#2  

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.


    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...


    private void btnGetX_Click(object sender, EventArgs e) {

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

      Log(retVal);
    }

#3  

@DJSure - Thank you Thank you! :D

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

#4  

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

South Africa
#5  

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

PRO
Synthiam
#6  

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 ARC (non programmers) software.:) yes, it does everything including autonomous navigation by detecting objects in it's way with the radar controls.