[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction part 2]

Introduction

This article is a sequel to the article below.

[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction first part]

Overview

In the second part, we will explain how to build a Java programming development environment using leJOS. Use eclipse for Java integrated development environment. Build the program with eclipse, transfer the generated executable file to EV3 and execute it. By using the eclipse plugin for leJOS, those tasks can be done only on the IDE, which is very convenient.

environment

Development environment construction procedure

eclipse installation

Download eclipse and install it according to the GUI. https://eclipse.org/downloads/

Let's start it. スクリーンショット 2017-02-21 17.30.52.png

installation of leJOS plugin

Select "Install New Software" from "Help" on the menu bar.

スクリーンショット 2017-02-21 14.42.39.png

Add repository Set Location to http://www.lejos.org/tools/eclipse/plugin/ev3/ and select OK. スクリーンショット 2017-02-21 14.44.01.png Check leJOS Ev3 Support and select Next. スクリーンショット 2017-02-21 14.44.29.png

Click OK or Next for the confirmation screen, license agreement screen, and warning screen that will appear after this. (Image omitted)

leJOS plugin preferences

Select "Preferences" from "Eclipse" on the menu bar. Set the path to the folder where you unzipped leJOS_EV3_0.9.1-beta.tar.gz downloaded in the first part to EV3_HOME. ..

Also, set the IP address of the EV3 main unit. スクリーンショット 2017-02-21 17.47.01.png

Let's make a project

Select "File"-> "New"-> "Other" from the menu bar. Then select LeJOS EV3 Project and proceed to OK. スクリーンショット 2017-02-21 14.50.00.png

Decide on a project name. Here, I chose Ev3Test. スクリーンショット 2017-02-21 14.57.28.png

You can see that the project was created correctly by looking at the Package Explorer. スクリーンショット 2017-02-21 18.01.39.png

Right-click on the project and select New-> Class. Here, the class name is set to Ev3Test. スクリーンショット 2017-02-21 14.53.57.png

Edit program

Let's make a simple program. Create a program that only displays Hello World on the LCD by referring to the sample code.

Ec3Test.java


import lejos.hardware.BrickFinder;
import lejos.hardware.Keys;
import lejos.hardware.ev3.EV3;
import lejos.hardware.lcd.TextLCD;


public class Ev3Test {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		EV3 ev3 = (EV3) BrickFinder.getLocal();
		TextLCD lcd = ev3.getTextLCD();
		Keys keys = ev3.getKeys();
		
		lcd.drawString("Hello World", 4, 4);
		keys.waitForAnyPress();
	}

}

Build and transfer

Right-click on the project and select Run as-> LeJOS EV3 Program.

スクリーンショット 2017-02-21 18.15.55.png

The program is built, transferred to the EV3 main unit, and executed. If successful, the following log will be displayed on the eclipse console.

IP address is /192.168.2.91
Uploading to 192.168.2.91 ...
Program has been uploaded
Running program ...
leJOS EV3 plugin launch complete

Display on the EV3 main unit. Press any button to exit the program. 1.jpg

Summary

Now you have an environment for developing EV3 using Java. If you want more information, please check the leJOS site. https://sourceforge.net/projects/lejos/

reference

https://sourceforge.net/p/etroboev3/wiki/lejosev3_mac_eclipse_section06/

Recommended Posts

[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction part 2]
[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction first part]
JavaFX environment construction in Java 13
[Java] Environment construction
Java environment construction
Play Framework 2.6 (Java) environment construction in Eclipse
Road to Java Engineer Part1 Introduction & Environment Construction
java development environment construction
Null-safe program in Java (Eclipse)
AtCoder Challenge Environment Construction (Java 8)
Web application development environment construction in Java (for inexperienced people)
Java Spring environment in vs Code
Let's use Twilio in Java! (Introduction)
[ev3 × Java] leJOS development environment construction (Eclipse on Mac OSX / bluetooth)
Creating lexical analysis in Java 8 (Part 2)
[Java & SpringBoot] Environment Construction for Mac
Creating lexical analysis in Java 8 (Part 1)
Let's think about what declarative programming is in Java and Elm (Part 1)
Java EE 8 (using NetBeans IDE 8.2) starting from sample code Part 1 Environment construction
Java container performance degradation in Menicoa environment
Java runtime environment construction method (Tomcat @ Linux)
Use OpenCV_Contrib (ArUco) in Java! (Part 2-Programming)
[Processing x Java] Construction of development environment
Java development environment construction memo on Mac
Let's create a Java development environment (updating)
Spring Boot + Docker Java development environment construction
Creating a matrix class in Java Part 1
Program PDF headers and footers in Java
Java application development environment created in VM environment
Minimal Java environment construction and Hello World
[Note] Execute java program in the integrated development environment Eclipse-I tried using git
I made a primality test program in Java
[LeJOS] Let's control the EV3 motor with Java
Quick learning Java "Introduction?" Part 1 Building an environment
Use OpenCV_Contrib (ArUco) in Java! (Part 1-Build) (OpenCV-3.4.4)
CI / CD practice for beginners --Part1 --Environment construction
When there are environment variables in Java tests
Solution for NetBeans 8.2 not working in Java 9 environment
JAVA + STS (Spring Tool Suite) environment construction procedure
I wrote a primality test program in Java
Let's create a super-simple web framework in Java
[Notepad ++] C language / Java compilation & execution environment construction
Let's keep this in mind What's new in Java 9
What I learned in Java (Part 2) What are variables?
[Note] Struts2 environment construction using Gradle in Eclipse
I wrote a prime factorization program in Java
Points stuck in building VSCode & Java development environment
[Beginner] Install java development tool in cloud9 development environment.
Replacing system environment variables by reflection in java
Java development environment construction (Mac + Pleiades All in One Eclipse 4.7 + Spring Boot + Gradle (Buildship))