hi everyone,
i have a problem that i need to solve, i have to read some data from a COM port, where is attached Arduino that send this data. i tryed to build some Daemons or a while loop that read this data, but it doesn't work properly because the COM result always busy in one of the two parts (or Arduino or my Java loop)
SO.......i wanted to ask
is it possible directly from Arduino language save this variable (not more than 3 char of length) in an external file like an XML or something like that (also a database, but well, i think it's kind of impossible)?
this will make my problem really solved.
is it possible directly from Arduino language save this variable (not more than 3 char of length) in an external file like an XML or something like that (also a database, but well, i think it's kind of impossible)?
No, it is not. The Arduino can not access hardware on the PC. It can, at most, talk to the serial port. An application on the PC needs to listen to the port, read the data, and save it to a file.
i tryed to build some Daemons or a while loop that read this data, but it doesn't work properly because the COM result always busy in one of the two parts (or Arduino or my Java loop)
You are not trying to have to Serial Monitor open at the same time as your program, are you?
is it possible directly from Arduino language save this variable (not more than 3 char of length) in an external file like an XML or something like that (also a database, but well, i think it's kind of impossible)?
No, it is not. The Arduino can not access hardware on the PC. It can, at most, talk to the serial port. An application on the PC needs to listen to the port, read the data, and save it to a file.
i tryed to build some Daemons or a while loop that read this data, but it doesn't work properly because the COM result always busy in one of the two parts (or Arduino or my Java loop)
You are not trying to have to Serial Monitor open at the same time as your program, are you?
thanks for the answer, well, i don't use the serial monitor, because i tested the arduino program before and i know that it works so nope..that's not the problem..maybe (i thinked) that arduino program open the port, and use it and remaining in wait state maybe the other program see it busy..
Akira_Garashi:
the COM result always busy in one of the two parts (or Arduino or my Java loop)
Only one application on the PC can access the Arduino's serial port at any time.
You would need to close the Arduino serial monitor (and avoid doing anything that would cause the IDE to connect to the Arduino) in order to allow your Java application to connect to the Arduino for testing.
You would need to close your Java app in order to allow the Arduino IDE to connect to the Arduino to upload a new sketch.
As long as only one or the other is trying to connect to the Arduino at any given time, you should be OK.
Also note that the Arduino will typically reset when the serial port is opened on the PC, so you will need to design your Java application to allow time for the Arduino to boot after it opens the port and to avoid repeatedly closing and reopening the port. Your Java application should also be designed to deal with the fact that the identify of the serial port associated with your Arduino may change over time.