[pi4j] University project, students in trouble!

Hi, I’m a french student in IT, my mates and I are currently working on the GoPiGo from dexter industries.
Our main goal consist of writting a Java program (using pi4j lib) which could manipulate the GoPiGo (just like the python script does).

We’ve got the first trouble connecting the GoPiGo on the network. pinging the dex.local wasn’t possible, thanx to this forum, we found a solution by setting up a fixed IP adress so we can connect to the Pi with VNC.

Python test script worked correctly so we can play with the GoPiGo thought the terminal.

I have to admit, we’re a bit lost. How are we suppose to work ?
Should I install pi4j library on a my computer where I could write Java source code then compile it using pi4j lib then executing bin files on the Pi ?
Or simpli compile the .java to bin on the Pi ?

Thanx for reading, hope you can help us gettin a clean project.

Hey JordanG,
Great to hear that your GopiGo is working now. There is a Java library available for the GoPiGo. The library is entirely contributed by the community so you can have a look at it here: https://github.com/DexterInd/GoPiGo/tree/master/Software/Java. You should also read through this to understand how the GoPiGo works: http://www.dexterindustries.com/GrovePi/engineering/software-architecture/. This is for the GrovePi but almost the same for the GoPiGo. In this file, you can see that the Java library also uses low level I2C commands to actually send and receive data from the GoPiGo: https://github.com/DexterInd/GoPiGo/blob/146d8ce6da5414beba8a085df112882ae0597963/Software/Java/src/com/dexterind/gopigo/components/Board.java.

Do let us know if you have any more questions.

-Karan

Very interesting link Karan, thanx you. It’s gonna be useful when we will be writting our project report.
So, shall I write je java code on my computer, then compile it using pi4j, then execute the byte code on the GoPiGo ?

I think you’ll have to write, compile and execute it on the Raspberry Pi itself, mostly because it would need access to the I2C port and the program might be platform dependent and might not work on the Pi if you compile it something else.

-Karan

Hello again,

My friends and I are already facing a new problem !
We compiled the library and run the test program (./scripts/compile.sh && ./scripts/Test.sh), everything works great.
Now, we would like to compile & run our own program. Unfortunatly, we are not experimented enought to deal with it.
How is it suppose to be ? Shall we create a new file (importing pi4j lib in) then compile it with the scripts ?

Students in trouble again, help please ! :slight_smile:

A gentle suggestion: it looks like you might not have much experience using Java; is there another programming language you are more experienced in?