Asked — Edited
Resolved Resolved by DJ Sures!

Sonar For Universalbot

Hello,

First a little background: I have to do a senior project for my class. The thing is it had to use the raspberry pi. So I chose to use the raspberry pi and the Ez-Robot for my project. I have windows IOT on my raspberry pi and have the universalbot sdk/project. I have looked through the code and didn't find a class for the sonar.

My question is How would i get values from the sonar using the universalbot application? And do I have to do anything special in order to recieve the value from there? Any help would be appreciated. Thank YOU.


ARC Pro

Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

#17  

@dj-sures , is it possible that when I create an Ez-Robot object it needs an argument.

PRO
Synthiam
#18  

Oh right, the example needs updating. The ezb creator needs a string argument that is the name for the object. It's any name you wish to give it. This is incase you have many Ezbs and wish to display names to the user associated with each instance.

Check the ez_b.xml file included in the mono package for syntax parameters. The xml file should always be the first place for you to look for syntax assistance.

Here's the ezb create from the xml...

Quote:

<member name="M:EZ_B.EZB.#ctor(System.String)"> <summary> Create an instance of the EZCommunicator and assign unique name </summary>

I'm on my phone so it's tough to write code but the syntax would be something like


EZB ezb = new EZB(&quot;my ezb&quot;);

I'll update the example later today or tonight.

#19  

THank you so much for your help

PRO
Synthiam
#20  

Great to hear it's working for you Anthony! Looking forward to hearing more about your project as it progresses

#21  

Hello! I know this was posted 2 years ago and a solution was found I wanted to give a little heads up that the mono.sdk example code hasn't been updated yet!

For anyone who hasn't found a solution here's what I changed my code to:


using System;
using EZ_B;
  
public class HelloWorld {


    public static void Main() {

        EZB ezb = new EZB(&quot;my ezb&quot;);

        Console.WriteLine(&quot;Connecting to EZ-B v4...&quot;);

        ezb.Connect(&quot;192.168.1.1&quot;);

        if (!ezb.IsConnected) {

            Console.WriteLine(&quot;Unable to connect to EZ-B v4&quot;);

            return;
        }

        Console.WriteLine(&quot;Hello World, I am moving servo d0 to position 90!&quot;);
 
        ezb.Servo.SetServoPosition(Servo.ServoPortEnum.D0, 90);

        ezb.Disconnect();
    }
}