- Notifications
You must be signed in to change notification settings - Fork46
Closed
Description
After transferring the following source code from LeJOS to ev3dev the LocalEV3-Class is not compatible.
packagecolorSensor;importev3dev.actuators.lego.motors.EV3LargeRegulatedMotor;importev3dev.sensors.ev3.EV3ColorSensor;importlejos.hardware.Key;importlejos.hardware.port.MotorPort;importlejos.hardware.port.SensorPort;importlejos.utility.Delay;publicclassEv3devColorSensorRedMode {publicstaticvoidmain(String[]args) {EV3ColorSensorcolorSensor =newEV3ColorSensor(SensorPort.S1);colorSensor.setCurrentMode("Red");float[]sample =newfloat[colorSensor.sampleSize()];/* HERE */Keyesc =LocalEV3.get().getKey("Escape");/* HERE */EV3LargeRegulatedMotormotor =newEV3LargeRegulatedMotor(MotorPort.A);motor.setSpeed(80);while (esc.isUp()) {colorSensor.fetchSample(sample,0);System.out.println(sample[0]);if (sample[0] >0.5) {motor.stop(); }else {motor.forward(); }Delay.msDelay(1000); }motor.close(); }}