Printing "Hello World!" to the ev3dev device is what the easiest thing to deal with in Java.
package org.ev3dev.examples; public class HelloWorldDemo { //HelloWorldDemo Class public static void main(String[] args){ //Main method System.out.println("Hello World!"); //Print Hello World to System.out } }
Notice: LCD Graphics processing is quite slow on the EV3.
Besides of having "Hello World!" printed to the console, we can also write/draw it to the LCD.
package org.ev3dev.examples; //Import necessary classes import org.ev3dev.hardware.lcd.LCD; import org.ev3dev.hardware.lcd.LCDGraphics; public class HelloWorldLCDDemo { //HelloWorldLCDDemo Class public static void main(String[] args){ //Main method LCD lcd = new LCD(); //Creates an ev3dev LCD instance LCDGraphics g = new LCDGraphics(lcd); //Creates a LCDGraphics instance, which has the same functionality of a Graphics2D class g.drawString("Hello World!", 50, 50); //Draws Hello World, takes some time on the EV3 g.flush(); //Renders the image and flush to the LCD, takes some time on the EV3 } }
That's easy right? Let's go deeper about the motors.