Hi
I’m part of a team that are working towards enabling the Arduino board to be driven by high level languages running on a computer.
We have focused on Java and have created JArduino. The JArduino code runs on the computer and comunicates with a Arduino board,
so you can controll all the pins as you normally can with c++.
Why use JArduino you say?
Well, JArduino enables you to write java applications that can easily communicate with your arduino board.
JArduino gives a good hardware abstraction and don’t allow you to write/read from unexisting pins (unlike the native Arduino language)
It’s easier to learn for people already familiar with Java.
and many more good arguments smiley-wink
The Jarduino package also comes with a grapichal program which allows you to click on a pin and send a digital write to it, and it will be visualized on screen AND it will perform a digital write on a connected Arduino board.
This means that you can test you Arduino setup before you code it.
From this program it is also possible to define a program flow and compile it into both JArduino code and native Arduino code.
If you want to try it out you can find the repository here: https://github.com/ffleurey/JArduino
And a wiki page with (hopefully) everything you need to know https://github.com/ffleurey/JArduino/wiki
A two minute tutorial to get started https://github.com/ffleurey/JArduino/wi … e-Tutorial
I hope you can make use of this library and spread the word.
Here is an example of the Blink scetch written in Java.
import org.sintef.jarduino.DigitalPin;
import org.sintef.jarduino.DigitalState;
import org.sintef.jarduino.JArduino;
import org.sintef.jarduino.PinMode;
import org.sintef.jarduino.comm.Serial4JArduino;
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
public class Blink extends JArduino {
public Blink(String port) {
super(port);
}
@Override
protected void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(DigitalPin.PIN_13, PinMode.OUTPUT);
}
@Override
protected void loop() {
// set the LED on
digitalWrite(DigitalPin.PIN_13, DigitalState.HIGH);
delay(1000); // wait for a second
// set the LED off
digitalWrite(DigitalPin.PIN_13, DigitalState.LOW);
delay(1000); // wait for a second
}
public static void main(String[] args) {
String serialPort;
if (args.length == 1) {
serialPort = args[0];
} else {
serialPort = Serial4JArduino.selectSerialPort();//Serial chooser interface
}
JArduino arduino = new Blink(serialPort);
arduino.runArduinoProcess();
}
}
This is absolutely more code then what you must write in the native Arduino language. BUT, the advantage is that now everything that you can get input from in java can manipulate your Arduino board.
Some screenshoots follow
You can click on a pin and then select what you want to do on that pin. Different pins have different attributes, e.g. AnalogPin, DigitalPin, InterruptPin etc.
http://pacelg.com/jarduino/ardu2.png
On the left side you get a program flow as you select action to perform, you can also add controll sequenses in this flow.
These controll sequences requires that you have don at least one analogRead or digitalRead
http://pacelg.com/jarduino/ardu3.png
Here you can see all the options you can do on DigitalPin_3 which is also a PWMPin and a interruptPin.
On the right side you can do writes to, and reads from the EEPROM memory.
http://pacelg.com/jarduino/ardu4.png
There is also possible to generate code, both for JArduino and for Arduino:
http://pacelg.com/jarduino/ardu5.png
Hope you will try out JArduino for a project or two. And please, help spread the word.
Happy coding
Tha Jarduino Team