Are you a Java EE programmer who wants to get all Internet-of-Things-y and:
- Switch lights on and off from a web app?
- Stream temperature sensor readings to a database?
- Use any Java EE web framework for building sophisticated GUIs to monitor and control low-power embedded devices?
Yup, us too. And more. That’s why we’re excited about getting our new Arduino feature for Liberty profile into Github.
What’s so awesome about an Arduino feature for Liberty?
Taking the Liberty Car as a fun example, we were able to stick a Raspberry Pi hosting a Liberty profile server on a remote-controlled car so that we could control the car using a mobile web app. Which was pretty cool anyway.
The Arduino feature enables us to reach for awesome (IOHO, anyway) by making it easy for us to add sensors to the car. So now the Liberty Car can detect for itself when it crosses the finishing line using a light sensor and LED. It can also…well, you’ll have to wait and see…
Seriously, what’s so awesome about an Arduino feature for Liberty?
Oh okay, put the Liberty Car to one side for a moment and think Internet of Things (IoT). Lots of little sensors monitoring light and temperature levels in greenhouses, oil flow through pipes, river water levels, energy consumption of appliances, and anything else you can think of.
Arduino is great for that kind of thing. The Arduino feature means you can write IoT applications using Java EE and running them on the lightweight, modular, dynamic Liberty profile.
The Arduino feature lets you can connect multiple Arduino microcontrollers to a Liberty server, either directly via USB cables or remotely using any of the many Arduino wireless technologies. You can then interact with the Arduinos from Java EE applications with an easy-to-use API.
And what can you do with Java and an Arduino?
Most of the functions that you can do within an Arduino sketch (the tiny applications that run on Arduinos) you can do using Java. That includes reading and writing to I/O pins, reading and writing to the Arduino microcontroller’s volatile and non-volatile memory, and invoking sketch functions.
With the APIs powerful callback capabilities, you can asynchronously trigger code on the Liberty server in response to certain conditions on the microcontroller that you’ve defined. For example, if a digital pin switches from high to low, an analogue pin goes above or below a certain voltage or changes by a certain amount, or a function on the microcontroller returns a particular value.
And it’s fun combining your Java coding skills with fiddling about with electronic bits and pieces and wires and stuff!
How easy is it to use?
It’s incredibly simple and easy to use. With just three steps and a few lines of code your applications and Arduinos can be working together.
Want to see how easy? We have a document showing the code and configuration we used for the LED demo!
Where can I have a go?
To learn more about the Liberty Arduino feature, head over to its page on Github. It’s open source and we have a lot of ideas and features still to add to the Arduino feature so we’d love your input and feedback.