Ultrasonic Sensor For NXT

HomeForumsMonoBrick Communication LibraryUltrasonic Sensor For NXT

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3933
    Author Image
    Chris Connor
    Participant

    I’m trying to get a reading for the sonar sensor (NXT) and the only way I can figure out how to do it is with NXT.Sensor1.ReadAsString() which returns the value with a ‘centimeter’ attached to it. As in the line of code will be Console.WriteLine(“Distance is ” + Cube.Sensor2.ReadAsString()); and the output is “Distance is X centimeters” which means I can’t convert it into an int data type to actually use the distance for anything useful. Looking through the library it says to use ReadDistance(), but that doesn’t work either. If somebody could help me that would be awesome thanks!

    #3938
    Author Image
    Anders Søborg
    Keymaster

    Hi

    Please post you code

    Anders

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

You must be logged in to reply to this topic.

Posted in

Make a donation