Installing the Software
First of all the software required must be installed on the Raspberry Pi:- Install PI4J.
curl -s get.pi4j.com | sudo bash - Set up the Raspberry for i2c communication.
- Install the Oracle JDK (if not already installed).
sudo apt-get install oracle-java8-jdk - Ensure that the Oracle JDK is the one in use (use java –version to verify).
If not change so that it is. There can be a massive performance difference. - Clone the robo4j repo.
git clone https://github.com/Robo4J/robo4j.git - Run gradlew build in the robo4j root directory.
- Install Eclipse (optional, but good if you want to play around with the examples a bit).
apt-get install eclipse
Setting up Eclipse (Optional)
For an easy way to play around with the examples, we can set up Eclipse on our Raspberry Pi.- Install Egit.
Inside of Eclipse, go to Help | Install New Software…
Add a new update site with the following URL:
http://download.eclipse.org/egit/updates-3.7.1/ - Install the Gradle plug-in.
http://download.eclipse.org/buildship/updates/e42/releases/2.x/ - Go to Robo4J on GitHub and clone the repo using Egit from within Eclipse.
- Import the projects into Eclipse.
Normally you would probably like to develop in a more modern version of Eclipse (or some other IDE) and just use the command line to build robo4j.
Running the Demos
There are two ways of running the demos. One through building the robo4j.jar file with Gradle, and one through Eclipse.Here is how you would, for example, run the LCD demo using the robo4j.jar built by gradle:
sudo java –classpath robo4j-hw-rpi/build/libs/robo4j-hw-rpi-alpha-0.2.jar:/opt/pi4j/lib/* com.robo4j.hw.rpi.i2c.adafruitlcd.DemoIf you are playing around with the code in Eclipse, do the following:
- With Eclipse started, open a command line and change directory to the robo4j/robo4j-hw-rpi/bin folder.
- Search for the demo/example corresponding to the hardware set up you want to test in the examples folder in the eclipse project.
For example, if you have an Adafruit LCD shield, you would use the com.robo4j.hw.rpi.i2c.adafruitlcd.Demo class. - Run the demo from the command line.
Do not forget to add the PI4J classes to the classpath, for example:
sudo java –classpath .:/opt/pi4j/lib/* com.robo4j.hw.rpi.i2c.adafruitlcd.Demo
Have fun!
Really very informative blog..Keep in blogging regularly to update these kinds of informatives.. Wish to learn Java, enroll you in Java Training in Velachery to learn more....
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training India . Nowadays Java has tons of job opportunities on various vertical industry.
ReplyDeleteThanks for sharing the information
ReplyDeletejava training center in south delhi
java training center in Noida
Such an informational blog, your blog will provide step-by-step instructions for how to quickly get started with the robo4j-hw-rpi module. We have wide range of wireless humidity sensors and wireless temperature sensors which are used 1 wire protocol.
ReplyDelete
ReplyDeleteKavita Sharma VIP female calls girls Escort service without condom French full Sexx yearly Sexx sucking and screwing in delight service independent escort service private girls 100% safe and secure 24 hours available!!!!!
Surat Escorts
Call Girls in Surat