Hi,
I tried to read any kind of sensors using my NXT 2 brick. Either the result is always 0 or I get a StackOverflowException (e.g. using the Sonar sensor)
Code example for Ultrasonic sensor (produces a StackOverflowException):
var brick = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
brick.Connection.Open();
var test = new Sonar(SonarMode.Centimeter);
brick.Sensor4 = test;
Console.WriteLine(test.ReadDistance());
brick.Connection.Close();
Code example for Touch sensor (reads always 0)
var brick = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
brick.Connection.Open();
var test = new TouchSensor();
brick.Sensor1 = test;
Console.WriteLine(test.Read());
In any case the IsInitialized property is always false. Also calling test.Initialize() doesn’t change anything.
Follow