No Ultrasonic sensor class in library

HomeForumsMonoBrick Communication LibraryNo Ultrasonic sensor class in library

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5307
    Author Image
    Edward Hobbs
    Participant

    Hi, I’m trying to use an NXT Ultrasonic Sensor with an EV3 brain. According to the documentation, I should use the following:

    var brain = new Brick<Sensor, Sensor, Sensor, Sensor>("com6"); //set up brick
    brain.Connection.Open(); //connect to brick
    brain.Sensor1 = new UltrasonicSensor();

    However, trying this brings up a compile error:

    MonoBrick.EV3.UltrasonicSensor is inaccessible due to its protection level
    and
    MonoBrick.EV3.UltrasonicSensor has no constructors defined

    I have linked the communication library .dll properly, as tab completion is working (Visual Studio 2013), and creating the brick object works fine. Is there something I’m missing to get this sensor working?

    #5313
    Author Image
    Anders Søborg
    Keymaster

    Hi there

    In the source code the ultrasonic sensor is internal. This means that the you can not access the class if you use the DLL. This is a bug that has already been fixed as seen here. But the new source have not been compiled and released. So there are two ways that you can solve the problem. Use the library that comes with the the test project or compile the DLL yourself use the Github“>Github source. Hope this answers your question.

    /Anders

    #5315
    Author Image
    Edward Hobbs
    Participant

    Thanks very much, that’s fixed the issue!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Posted in

Make a donation