By Miroslav Kopecky
Img.1: Let’s turn on the LegoBrick again and make remote project based on Gradle
The previous post about Lego MindStorm EV3  focused on its installation. I’ve also touched how to install JavaJDK setup Wi-Fi on LegoBrick + small sample “hello world” project. This blog post is about setting up little more advanced project.

The simple HelloWorldGradle Remote project uses:

With the LegoBrick connected to Wi-Fi, it’s possible to access it remotely without problem using the Java Remote Method Invocation, or RMI for short.
RemoteEV3 ev3Brick = new RemoteEV3(EV3BRICK_IP);  

Before we start working on the sample source code we create a Gradle project. Let’s randomly title the project as HelloWorldGradle. It’s important to setup the Gradle property file “build.gradle” correctly.

apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
version = '1.0'
repositories {
dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile 'lejos:ev3classes:1.0-SNAPSHOT'
    compile ('log4j:log4j:1.2.17'){
        exclude group: "com.sun.jdmk", module: "jmxtools"
        exclude group: "javax.jms", module: "jms"
        exclude group: "com.sun.jmx", module: "jmxri"
    compile 'org.slf4j:slf4j-log4j12:1.7.5'

jar library “ev3classes” is very important! This library creates the gateway into the Lego hardware by using RMI because EV3 acts as the RMI Registry. You need to create it by yourself.


This library can be created with Maven with the usage of maven-assembly-plugin. The final *.jar file can then easily imported into the local maven cache.

Now we are ready to remotely access our Lego MindStorm robot and in our case let him to play a short song.

RemoteEV3 ev3Brick = new RemoteEV3(EV3BRICK_IP);
            Audio soundProcessor = ev3Brick.getAudio();
            List<integer> tones = new ArrayList<>(asList(0,1,2,3,4,5));
            tones.forEach(tone -> {

The sample LejOS remote project HelloWorldGradle is available here (GITHub).


Lego Mindstorm EV3: Java8, LeJOS and Gradle with a Taste of Maven

| Mind the Geek| 690 views | 0 Comments
About The Author

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>