Hot answers tagged


There are a few different but related problems here. Position Your robot should be able to know where it is in the room. This can be achieved in a few ways: Using the ultrasonic sensor as a sonar, rotating it around and storing the readouts, then calcualting based on the known map of the room (if the layout is fixed and known in advance). Tracking the ...


You can use the lejos.ev3.robotics.RangeFinder abstraction class: EV3UltrasonicSensor sensorUS; RangeFinder sonar; public UltrasonicSensor(Port port) { sensorUS = new EV3UltrasonicSensor(port); sonar = new RangeFinder(sensorUS); } @Override public boolean takeControl() { return sonar.getRange() < 0.3; } Use the float getRange() method to ...


As you suspected, you cannot use the Ultrasonic sensor without an "Intelligent Brick" (EV3 or NXT). MINDSTROMS would be a great way to automate your train if you are willing to make the investment. For more ideas on how to use LEGO MINDSTORMS with LEGO trains, check out Sioux.NET.

Only top voted, non community-wiki answers of a minimum length are eligible