I have just written a java algorithm to get a chess move when a chess move is inputted in SAN notation the algorithm used : Monte Carlo. Is it possible to integrate this program with an Arduino mega and How?
My mega will be getting inputs from a sensory board and I want to send these inputs to the java program without using any additional board.
Note:
By integrate I mean that the Java program should run in the Arduino mega itself
Can anyone suggest a solution?
-
2Do you want to run the Java program inside the Arduino, or do you want to use the Arduino as an IO device for a PC running the Java program?Edgar Bonet– Edgar Bonet2018年07月07日 13:30:35 +00:00Commented Jul 7, 2018 at 13:30
-
@EdgarBonet I want to run the java program inside the Arduino.roaibrain– roaibrain2018年07月07日 17:28:55 +00:00Commented Jul 7, 2018 at 17:28
-
Now click on the "edit" link just below your post and revise your question to make that clear. The question should be self contained, one should not have to read through the comments to understand it.Edgar Bonet– Edgar Bonet2018年07月07日 19:32:50 +00:00Commented Jul 7, 2018 at 19:32
1 Answer 1
There is a project called uJ by Dmitry Grinberg that enables you to do that, somehow. It has been tested on AVR devices too, not your particular one however. Knowing AVRs, that shouldn't be a stopper at all.
That said, I don't think it's a very good idea. The overhead of the JVM may only let you handle some 'slow' signals, unless you heavily rely on peripherals and wit to do stuff. Though in your particular application, that shouldn't be that much of an issue.
Instead of having the trouble of running a JVM and such, you may just as well rewrite the code in C/C++ or whatever, even for increased efficiency. There may also be some Java to C transpilers, I haven't looked, wary of the dragons.
However, if you eventually decide against that and instead choose to talk to the microcontroller over serial or something else, there is the (削除) dreadful (削除ここまで) excellent RxTx library for Java that works pretty fine after all, or the Firmata library.