Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Can't send integer to Arduno from Java on: April 14, 2009, 02:57:06 am
Yes, the problem was loosing bytes betweent Arduino and Computer, your method is good, firstly i was thinking about sending reply after each integer, but it would loose to much time. I will try yours method. Thanks!
2  Forum 2005-2010 (read only) / Troubleshooting / Re: Can't send integer to Arduno from Java on: April 13, 2009, 04:00:54 pm
Is working, thanks very much, maybe you know where I can find some materials about synchronization? Sending a lot of integers can cause some mistakes...
3  Forum 2005-2010 (read only) / Troubleshooting / Can't send integer to Arduno from Java on: April 10, 2009, 02:19:18 am
Hi, my new problem  ;D

I want to send integers from Java application to Arduino, the problem is that sketch is perfectly working with Serial monitor from Arduino compiler, but don't want to do it with my Java soft, maybr you know, where is the problem:

Code:
package arduino;

import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.io.InputStream;
import java.io.OutputStream;
import processing.app.Preferences;

public class Main {
    static InputStream input;
    static OutputStream output;

    public static void main(String[] args) throws Exception{
        Preferences.init();
        System.out.println("Using port: " + Preferences.get("serial.port"));
        CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(
                Preferences.get("serial.port"));

        SerialPort port = (SerialPort)portId.open("serial talk", 4000);
        input = port.getInputStream();
        output = port.getOutputStream();
        port.setSerialPortParams(Preferences.getInteger("serial.debug_rate"),
                SerialPort.DATABITS_8,
                SerialPort.STOPBITS_1,
                SerialPort.PARITY_NONE);


            boolean k=true;
            while(true)
            {
                if(k)
                {
               output.write(1200);
               output.flush();
               k=false;
                }

                
                while (input.available()!=0)
                {
            System.out.println((int)(input.read()));
                }

            }
    }
        
}



And Arduino sketch:

Code:

void setup()
{
  Serial.begin(9600);
}

void loop ()
{
  char serInString[20]="";
  int i=0;
  
    while (Serial.available())
  {
    serInString[i] = Serial.read();
    i++;
  }
  
  Serial.print(serInString);
  Serial.flush();
  delay(100);  // wait a bit, for serial data
}

4  Forum 2005-2010 (read only) / Interfacing / Re: Interfacing Java with Arduino on: March 08, 2009, 03:46:15 am
Problem is that I've done all intstructions from internet and there is still no change, maybe anybody can give me link to working tutorial? Maybe there is still something to do for me.
5  Forum 2005-2010 (read only) / Interfacing / Interfacing Java with Arduino on: March 04, 2009, 04:02:22 pm
Hi, this is my first post. I have Arduino a few days, but I still can't connect it and send any data to Arduino or receive it from Arduino using Java. I've tested RXTX and JavaComm but still there is nothing working, so maybe you will help me.

This is first version of my code:

Code:
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.*;
import java.io.InputStream;
import java.io.OutputStream;
import gnu.io.RXTXCommDriver.*;
import processing.app.Preferences;

public class Main {

    static InputStream input;
    static OutputStream output;

      public static void main(String[] args) throws Exception{

            Preferences.init();
            System.out.println("Using port: " + Preferences.get("serial.port"));

        System.out.print(CommPortIdentifier.getPortIdentifiers().toString());
      }

}

and output:
Code:
run:
Using port: COM4
java.lang.NoClassDefFoundError: javax/comm/CommDriver thrown while loading gnu.io.RXTXCommDriver
java.lang.NoClassDefFoundError: javax/comm/CommDriver thrown while loading gnu.io.RXTXCommDriver
gnu.io.CommPortEnumerator@5740bb
BUILD SUCCESSFUL (total time: 3 seconds)

There is also second version:
Code:
package arduino2;

import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.*;
import java.io.InputStream;
import java.io.OutputStream;
import gnu.io.RXTXCommDriver.*;
import processing.app.Preferences;

public class Main {

    static InputStream input;
    static OutputStream output;

      public static void main(String[] args) throws Exception{

            Preferences.init();
            System.out.println("Using port: " + Preferences.get("serial.port"));

        CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(Preferences.get("serial.port"));
        
            SerialPort port = (SerialPort)portId.open("serial madness", 4000);
        input = port.getInputStream();
        output = port.getOutputStream();
        port.setSerialPortParams(
                        Preferences.getInteger("serial.debug_rate"),
                        SerialPort.DATABITS_8,
                        SerialPort.STOPBITS_1,
                        SerialPort.PARITY_NONE);


            while(true){
                  while (input.available()>0)
                        System.out.print((char)(input.read()));
            }
      }

}

and output:
Code:
Using port: COM4
java.lang.NoClassDefFoundError: javax/comm/CommDriver thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" gnu.io.NoSuchPortException
        at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:218)
        at arduino2.Main.main(Main.java:21)
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)

With Arduino software all works fine, i don't understand why it doesn't with my soft. In Netbeans project are all .dll files, all Jar libraries from arduino lib folder and also preferences.txt .


But still no effect. Thanks for any help, maybe someone can upload working netbeans project, so i can try it out, maybe my laptop isn't working good, i'm looking errors all day long. Forgive me my english.
  
6  Forum 2005-2010 (read only) / Exhibition / Re: RGB Colour Mixer with DS touch screen on: May 29, 2009, 03:44:56 am
Is there any difference between upper and lower DS screen? I didn't know that Nintendo has touch screen, and the price is really interesting.
7  Forum 2005-2010 (read only) / Exhibition / Re: RGB Colour Mixer with DS touch screen on: May 28, 2009, 11:58:26 am
Hi, is there any chance to get some schemes or some source? On your website, there is no more info than just pictures. Good idea, but isn't DS touch screen too expensive for that? BTW very interesting project.
Pages: [1]