your java class is great. And if we can use it to send strings to Arduino, why not? I have no problem with that.
However, the issue now is that Arduino has to be able to read the information coming from serial (sent by our java API). It does well with the Serial.read() but byte per byte (this is my understanding). As an example, I want a variable declared in the firmware uploaded into Arduino as:unsigned
long Time = 0123456789;
Then "Time" would used as a time and date variable (in unix_t or EPOCH time format - see http://www.epochconverter.com
) by receiving its value from USB / and a host computer's java API. As you see, my variable has 10 bytes... so with Serial.read() in Arduino's firmware it seems to be too complex to get these and the other 30 variables loaded with their initial values from serial sent by a java API if in Arduino I use the "default" Serial library.
Our java classes and rxtx for the java API solved the connection problem. Now the communication is the next step. Using "Serial" library (which includes Serial.read) seems to be very limited. However, with Firmata it would be great. Your class is not competing with Firmata, I never had in my mind it attempted to replace Firmata since the problem now resides in Arduino's serial reading capability. Let me explain it; to use Firmata as a standard for communication we have to use it in both sides, Arduino board and the java API on the host computer. That is what France is asking too get, but building the host computer's API in Java. We can upload Firmata to Arduino but we do not have yet a Firmata version on the Java API developing side.
If moving our API form Java to C++, there are Firmata versions for the host computer (GPL for linux and LGPL for Windows). But we want to stand with Java. A solution is using "Processing": in one side uploading Firmata to Arduino and on the host computer including the "Firmata version for Processing" in Processing ( http://processing.org
). But Processing is not like using Eclipse or Netbeans to develop a Java API... We need a Firmata Java version or to improve the Serial.read function of Serial library for Arduino board... as in my case it would be enough something like Serial.readString()
function. Then what we have in our java classes would be enough.
Thanks for sharing your thoughts!
Maybe France found a workaround for that library...