collapse

* Posts Recentes

+ LASERs por dropes
[03 de Julho de 2025, 19:35]


Cerca eléctrica por SerraCabo
[14 de Junho de 2025, 23:26]


Alguém arranja motores? por almamater
[10 de Junho de 2025, 22:34]


Condensador 4.7uF 0603 por brunus
[09 de Junho de 2025, 15:52]


Lenovo IdeaPad 3 Não liga por jm_araujo
[07 de Maio de 2025, 19:10]


Identificar Diodo Zenner por filjoa
[01 de Maio de 2025, 23:07]


Meu novo robô por dropes
[18 de Março de 2025, 14:51]


JBL partybox On-The-Go por almamater
[21 de Fevereiro de 2025, 23:32]


Talking Reverse Engineering with an Absolute Legend! por SerraCabo
[13 de Fevereiro de 2025, 09:56]


Motoserra Stihl 120C por brunus
[11 de Fevereiro de 2025, 16:29]

Autor Tópico: arduino+java  (Lida 6894 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
arduino+java
« em: 04 de Novembro de 2010, 18:04 »
boas!

estava a tentar seguir este tutorial ( http://www.arduino.cc/playground/Interfacing/Java ) para por o arduino a comunicar com java, mas não estou a conseguir compilar....


Código: [Seleccione]


C:\Users\...>javac SerialTest.
java
SerialTest.java:3: package gnu.io does not exist
import gnu.io.CommPortIdentifier;
             ^
SerialTest.java:4: package gnu.io does not exist
import gnu.io.SerialPort;
             ^
SerialTest.java:5: package gnu.io does not exist
import gnu.io.SerialPortEvent;
             ^
SerialTest.java:6: package gnu.io does not exist
import gnu.io.SerialPortEventListener;
             ^
SerialTest.java:9: cannot find symbol
symbol: class SerialPortEventListener
public class SerialTest implements SerialPortEventListener {
                                   ^
SerialTest.java:10: cannot find symbol
symbol  : class SerialPort
location: class SerialTest
        SerialPort serialPort;
        ^
SerialTest.java:83: cannot find symbol
symbol  : class SerialPortEvent
location: class SerialTest
        public synchronized void serialEvent(SerialPortEvent oEvent) {
                                             ^
SerialTest.java:27: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                CommPortIdentifier portId = null;
                ^
SerialTest.java:28: cannot find symbol
symbol  : variable CommPortIdentifier
location: class SerialTest
                Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
                                       ^
SerialTest.java:32: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                        CommPortIdentifier currPortId = (CommPortIdentifier) por
tEnum.nextElement();
                        ^
SerialTest.java:32: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                        CommPortIdentifier currPortId = (CommPortIdentifier) por
tEnum.nextElement();
                                                         ^
SerialTest.java:48: cannot find symbol
symbol  : class SerialPort
location: class SerialTest
                        serialPort = (SerialPort) portId.open(this.getClass().ge
tName(),
                                      ^
SerialTest.java:53: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.DATABITS_8,
                                        ^
SerialTest.java:54: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.STOPBITS_1,
                                        ^
SerialTest.java:55: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.PARITY_NONE);
                                        ^
SerialTest.java:84: cannot find symbol
symbol  : variable SerialPortEvent
location: class SerialTest
                if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
                                             ^
16 errors

C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java>

ao que parece faltam as bibliotecas não é? mas segundo o tutorial:
Citar
RXTX Library Set Up

If you installed the Arduino IDE, you already have the RXTX library installed for the next steps, and you may be able to skip this section and start with the sample Java code.


há aqui qualquer coisa que me esta a escapar  ::)

Offline CBX

  • Mini Robot
  • *
  • Mensagens: 1.315
Re: arduino+java
« Responder #1 em: 04 de Novembro de 2010, 18:19 »
tens a biblioteca na pasta do java?

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
Re: arduino+java
« Responder #2 em: 04 de Novembro de 2010, 18:30 »
nop, é esta a pasta?

Citar
C:\Program Files\Java\jdk1.6.0_21\lib

copio o rxtxSerial.dll que esta na pasta do arduino para essa pasta mas não compila a mesma...

Offline CBX

  • Mini Robot
  • *
  • Mensagens: 1.315
Re: arduino+java
« Responder #3 em: 04 de Novembro de 2010, 19:10 »
vai a rxtx.org e faz download da biblioteca mais recente.

dentro do zip encontras o ficheiro "RXTXcomm.jar" que vai para a pasta ...\Java\jre1.6.0_21\lib\ext\ e o ficheiro "rxtxSerial.dll" para a pasta ...\Java\jre1.6.0_21\bin\

assim já deve funcionar  ;)

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
Re: arduino+java
« Responder #4 em: 04 de Novembro de 2010, 19:33 »
vai a rxtx.org e faz download da biblioteca mais recente.

dentro do zip encontras o ficheiro "RXTXcomm.jar" que vai para a pasta ...\Java\jre1.6.0_21\lib\ext\ e o ficheiro "rxtxSerial.dll" para a pasta ...\Java\jre1.6.0_21\bin\

assim já deve funcionar  ;)

fiz isso (não tinha  a pasta ext, por isso criei uma, copiei o .jar para a a ext e mantive uma copia também na pasta lib) e continua na mesma :S


Offline CBX

  • Mini Robot
  • *
  • Mensagens: 1.315
Re: arduino+java
« Responder #5 em: 04 de Novembro de 2010, 19:48 »
experimenta a copiar também o "rxtxParallel.dll", mais não te posso ajudar, isto é o que eu faço para um programa que aqui tenho em java funcionar, de java não percebo nada...

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
Re: arduino+java
« Responder #6 em: 04 de Novembro de 2010, 20:02 »
experimenta a copiar também o "rxtxParallel.dll", mais não te posso ajudar, isto é o que eu faço para um programa que aqui tenho em java funcionar, de java não percebo nada...

sim pus também esse ficheiro.

ok, obrigado pela ajuda que já deste  :)