Skip to content

LeJOS compatibility > LocalEV3-Class not available #524

Closed

Description

@abaumgart

After transferring the following source code from LeJOS to ev3dev the LocalEV3-Class is not compatible.

package colorSensor;

import ev3dev.actuators.lego.motors.EV3LargeRegulatedMotor;
import ev3dev.sensors.ev3.EV3ColorSensor;
import lejos.hardware.Key;
import lejos.hardware.port.MotorPort;
import lejos.hardware.port.SensorPort;
import lejos.utility.Delay;

public class Ev3devColorSensorRedMode {
    public static void main(String[] args) {
        EV3ColorSensor colorSensor = new EV3ColorSensor(SensorPort.S1);
        colorSensor.setCurrentMode("Red");
        float[] sample = new float[colorSensor.sampleSize()];

        /* HERE */ Key esc = LocalEV3.get().getKey("Escape"); /* HERE */

        EV3LargeRegulatedMotor motor = new EV3LargeRegulatedMotor(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();
    }
}

Activity

  1. self-assigned this
    on Aug 15, 2018
  2. jabrena commented on Aug 15, 2018

    @jabrena
    Member

    Hi @abaumgart,

    At the moment, we don´t have support for the class:

    LocalEV3.get()

    because that class normally is related with Remote operations. With current classes, you can do the same stuff.

    When we have the remote support, you could use that class and others like BrickFinder, Brick or RemoteEV3.

    But it is true that it could be a good enhancement.

    We will add in the future but you can develop the same logic using directly the class in charge of the Keys for EV3.

    Juan Antonio

  3. added this to the v1.0.0 milestone on Nov 4, 2018
  4. jabrena commented on Nov 11, 2018

    @jabrena
    Member

    Hi @abaumgart,
    I think that you could add this Object in the library if you are interested.

    It is not difficult:
    https://lejos.sourceforge.io/ev3/docs/lejos/hardware/ev3/LocalEV3.html

    What do you think?

    Juan Antonio

  5. removed this from the v1.0.0 milestone on Nov 17, 2018
  6. modified the milestone: v1.1.0 on Nov 24, 2018
  7. jabrena commented on Aug 18, 2019

    @jabrena
    Member

    No feedback
    Rejected by LEAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions