Friday, September 12, 2014

Friday Fun Component XVIIII


Yesterday night I needed some time to relax and when I looked on my Galaxy S4 I saw a little widget installed called Minimal Clock which is a nice example of a simple flat ui clock.
So I've decided to clone that widget in JavaFX and here is the result:

As you can see it looks very similar to the original version but it doesn't have all the features. My version only shows the time and date but one could define the colors for all the elements.
Like I said this control was only created to relax but hey...if you like it...fork it on bitbucket

BitBucket Repository

That's it for today and don't forget...keep coding :)

Thursday, July 17, 2014

Off to new horizons...

It's now more than 2 years ago when I've started working for Canoo Engineering and I have to say that I really enjoyed that time. It was always great to discuss topics with a bunch of really smart people.

But sometimes you get the chance to head to new horizons...

For me it was the question:
"Would you like to work together with Angela Caicedo, James Weaver, Stephen Chin and Simon Ritter in the evangelism team?"

And as you might guess already there was only one answer for me...YES OF COURSE!!!

So I'm happy to announce that as of 8/15/2014 I will join Oracle in Simon Ritter's team as Java Technology Evangelist.
As you might already know from my colleagues my job will be about blogging, speaking at conferences and Java User Groups and spreading the word about all things Java (especially Java in the IoT space).

So I'm really looking forward to spend all my energy in the technology that I like sooooo much...Java.

Keep coding...

Tuesday, June 24, 2014

OpenJFX for ARM v6 (hard and soft float)

Hi there,

This post is for all of you that play around with JavaFX on embedded devices. Not everyone is able or willing to build it's own version of OpenJFX and so I decided to build it regularly and provide a download link to it.
So here we go, I've set up the build in a Linux virtual machine on my mac and built the OpenJFX v6 hard and soft float version today.
You can find both versions here:

JDK8 OpenJFX ARMv6 hard float

JDK8 OpenJFX ARMv6 soft float

To use this you first need to install Java SE 8 embedded on your embedded system which you can find here (hard and soft float are available):

Java SE 8 Embedded and Java SE 8 Embedded HardFloat 

After you have installed Java8 on your embedded device you need to tell the Java runtime that you will use another jfxrt.jar instead of the default one. 
If you have installed JDK8 in /opt/jdk1.8.0 and the OpenJFX version in ~/openjfx on your embedded device you have to call your jar like follows:

/opt/jdk1.8.0/bin/java -Djava.ext.dirs=~/openjfx/armv6hf-sdk/rt/lib/ext -jar YOUR_APP.jar

The soft float version won't run on the Raspberry Pi (but you should be able to use the hard float version).

I hope this is useful for one or the other of you...

Keep coding...

Monday, May 5, 2014

Java 8 on Intel Galileo


Last week my Intel Galileo board arrived and last weekend I've started to play around with it. The target was to put Java on the Galileo (what else) and see what is possible. So the first thing I did was downloading and installing a Debian Wheezy Linux on a micro sd card. You can find different preconfigured distributions that have ssh server etc. already setup (I used this one). 
So after the Galileo booted in Debian I connected via ssh and set up the Linux in the same way I used to setup the Raspberry Pi. 
So usually I set up a new user, add him to the sudoers group, install mingetty to enable autologin and setup avahi daemon to be able to connect to the board from the Finder in OS X.
After that was done I've simply downloaded the appropriate JDK8 version for the Galileo platform (jdk-8u5-linux-i586.tar.gz).
The installation of JDK8 is the same as on the Pi, so simply copy the tar file to the Galileo and execute the following commands on the command line:

mkdir -p /opt
sudo tar zxvf jdk-8u5-linux-i586.tar.gz -C /opt
rm jdk-8u5-linux-i586.tar.gz

With this commands you install JDK8 in /opt/jdk1.8.0_05.
As next step I've setup JAVA_HOME as follows

sudo nano /etc/bash.bashrc

add the following two lines to the end of the file

export JAVA_HOME=/opt/jdk1.8.0_05
export PATH=$JAVA_HOME/bin:$PATH

Save the file with CTRL+O
The next time you login on the Galileo you should be able to type

java -version

on the command line and you should see something like this

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05_b13)
Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)

Now that I had Java 8 on the Galileo the question was how to make use of the GPIO and Analog ports of the Galileo. Because there is no direct way in Java to access the IO-ports of the Galileo board (because there is nothing like Pi4J for the Galileo) you have to use a little workaround to address the IO-ports.
Fortunately there is a nice website that explains how to address the IO-ports of the Galileo board from the Linux console. The approach is to use the file system to address the IO-ports. Well addressing the file system is very easy to do in Java and so I wrote a little library that enables me to address the ports on the Intel Galileo from Java.
At the moment this is just something to play with and because it's based on the file system approach it's not really something you would like to use on the regular basis but he...it works :)
My idea was to use the IO-ports of the Galileo with the names of the Arduino shield connector. Means we have 6 analog ports (A0 - A5) and 13 digital ports (D0 - D13) that can be used. I just made two little tests with D13 and A0 and both worked but I can't guarantee that everything works as it should...so be careful.
At the moment you can set and read the digital pins D0..D13 and you can read the analog pins A0...A5. There is no support for pulse-width modulation (pwm) at the moment but I'll maybe add it in the near future.

Because I had a spare TMP36 analog temperature sensor lying around I've connected it to the 5V and GND pins of the Intel Galileo and the data pin I've connected to A0. With my GalileoIO library the following code is needed to read out the value at A0 and print it on the console.

// Read analog value from A0 with TMP36 connected
public class Main {
  public Main() {
    // Instantiate the GalileoIO library
    final GalileoIO galileoIO = new GalileoIO();            
    // Read out the voltage at A0 in millivolt
    double voltage = galileoIO.getAnalog(Analog.A0);
    // Calculate the temperature from the voltage of the TMP36
    double temp = (voltage - 500d) / 10d;        
    // Print the temperature on the console
    PrintStream out = new PrintStream(System.out, true, "UTF-8");
    out.println("Temperature: "
                temp + 
                "\u00B0C ("
                voltage + 
                " [mV])");                
  public static void main(String[] args) {
    new Main();


Another example would be to set a digital pin to high and the code you need to do this is as follows

// Set D13 to high
public class Main {
  public Main() {
    // Instantiate the GalileoIO library
    final GalileoIO galileoIO = new GalileoIO();            
    // Set D13 to high
    galileoIO.setDigital(Digital.D13, Pin.Value.HIGH);
    // Wait for 3 seconds
    try {
    } catch (InterruptedException exception) {}    
    // Set D13 to low
    galileoIO.setDigital(Digital.D13, Pin.Value.LOW);

  public static void main(String[] args) {
    new Main();


To make sure the IO-ports will be unexported again I've added a shutdown hook to the GalileoIO library that will unexport all used ports when the JVM shuts down.

If you are interested in the code feel free to fork it on BitBucket.

That's it for today...so keep coding...

Friday, May 2, 2014

Enzo is on Maven Central

Just a short announcement...if you like you could find the JavaFX 8 controls library "Enzo" now on Maven Central.

That was really short...so keep coding... 

Tuesday, April 29, 2014

NeoPixel24 Ring

Hi there,

This is just a short post about a little JavaFX control that I've created last weekend. Some time ago I've bought a NeoPixel24 ring from Adafruit and last weekend I've started to play around with it. For those of you that don't know the NeoPixel ring, here is a little image...

As you can see it is a simple ring of RGB led's.

Connecting the NeoPixel ring to my Arduino YUN was really easy and with the help of the Adafruit NeoPixel library for Arduino it was a piece of cake to control the NeoPixel ring via code.
But I'm a Java guy and like to code Java so I was thinking about how to make use of the NeoPixel ring from my desktop machine and decided to create a JavaFX control that represents the NeoPixel ring.
Long story short...that's how it looks like...

It's not a really fancy looking control but might be useful for one or the other. First I've started to create the control from JavaFX nodes using CSS to style it but after some tests I've decided to use the Canvas node to create the control. The reason for this decision is the fact that I have to change the color of each led very often which is not the best thing to do in CSS. In Canvas this is very easy because I simply redraw the led's (and only the led's because the ring and the led frames are in a separate Canvas node) which is fast enough.
For my little test project I simply increased the no of activated led's and sent the number of active led's and the current color via MQTT to the Arduino YUN which sets the real NeoPixel ring in the same way. So I can use the NeoPixel ring as some kind of a temperature gauge.
Here is a little video that shows the result...

And if you are interested in the code of the NeoPixel24 JavaFX control, feel free to fork it on Bitbucket.

Because I've ordered a NeoPixel ring 60 from Adafruit to build a little clock with it, I've also added a NeoPixel60 JavaFX control to the project on Bitbucket. To give you an idea how it looks like, here it is:

That's it for today, so keep coding...

Friday, April 18, 2014



And another one from Canada. After I've ported two controls from the SteelSeries to JavaFX 8 I thought it might make sense to add a third one...the Altimeter control.
But after I've created the control I thought it now might make sense to add those three controls to a little library because they are somehow related to each other.
So I've created a library called AirSeries which contains the AirCompass, the Horizon and the Altimeter control.
If you check out the source code at Bitbucket you will find a Demo class in the project and when you start it you will see something like this...

And if you want to see it in Action you might want to check this YouTube video.

I can't guarantee that these controls work exactly right because I've never used them by myself and did them only because some people asked me to create them. So if you find some problems, do not hesitate to send pull-requests :)

So happy easter to all of you and keep coding...