EV3 lejos error: unable to open port

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

java
New User
Posts: 1
Joined: Mon Aug 14, 2017 8:31 am

EV3 lejos error: unable to open port

Postby java » Mon Aug 14, 2017 8:42 am

Hello,
I am new in programming in leJos, not in java, and I wrote this simple program:

Code: Select all

import lejos.hardware.motor.EV3LargeRegulatedMotor;
import lejos.hardware.port.MotorPort;

public class Main {
   
   public static void main(String[] args) {
      
      EV3LargeRegulatedMotor m = new EV3LargeRegulatedMotor(MotorPort.A);
      m.rotate(360);
   }

}


But I get this error:

Code: Select all

"Uncaught exception:

lejos.hardware.DeviceException
unable to open port"


I don't understand why: there is the good motor in the good port and I don't open the port twice.

Thank you for your answers

User avatar
gloomyandy
leJOS Team Member
Posts: 5899
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: EV3 lejos error: unable to open port

Postby gloomyandy » Mon Aug 14, 2017 12:46 pm

Hi and welcome to leJOS. I've moved your question to a more suitable part of the forum, the development area is intended for discussions about actually developing leJOS.

As to your problem. We need to know a little more about what you are doing. Are you running that code on the EV3 itself or are you running it on a PC/Mac and using the remote capabilities of leJOS? Also when asking for help please provide as much information as possible. So for instance, what version of leJOS are you running? Is this the first time you have run your program? What steps have you already taken to solve the problem?

Either way that error means that the port you are trying to use is already open by some other application. The most usual cause of this is when a remote program makes use of a port and exits without closing it. The remote code will not clean up things like this automatically (unlike if you run a program on the EV3 directly), so you need to make sure you close all open motors/sensors before you exit the program. If you get this sort of error you can usually clear it by choosing the "reset" option from the "system" menu on the EV3, if that does not work try turning the EV3 off and on again then try the program again.
leJOS news https://lejosnews.wordpress.com/


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 1 guest