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!
Follow