Heho!
I'm using the neorainbowduino firmware for my rainbowduino. In short it works like this:
Processing -> Arduino -> I2C -> rainbowduino -> RGB Matrix
The connection is startet with:
//create a list with i2c slave destination (=rainbowduinos)
List<Integer> i2cDest = new ArrayList<Integer>();
i2cDest.add(5);
try {
//initialize library
rainbowduino = new Rainbowduino(this, i2cDest,);
} catch (Exception e) {
//if an error occours handle it here!
//we just print out the stacktrace and exit.
e.printStackTrace();
println("failed to initialize serial port - exit!");
exit();
}
Then it tries all the availible COM Ports until it gets to my FDTI Cable. I want to set the port manually and found something in the rainbowduino library
/**
* Create a new instance to communicate with the rainbowduino.
*
* @param _app
* @param rainbowduinoAddr
* @param portName
* @throws NoSerialPortFoundException
*/
public Rainbowduino(PApplet _app, List<Integer> rainbowduinoAddr, String portName)
throws NoSerialPortFoundException {
this(_app, portName, 0, rainbowduinoAddr);
}
/**
* Create a new instance to communicate with the rainbowduino.
*
* @param _app
* @param portName
* @param baud
* @param rainbowduinoAddr
* @throws NoSerialPortFoundException
*/
public Rainbowduino(PApplet _app, String portName, int baud, List<Integer> rainbowduinoAddr)
throws NoSerialPortFoundException {
log.log(Level.INFO, "Initialize neorainbowduino lib v{0}", VERSION);
this.app = _app;
app.registerDispose(this);
scannedI2cDevices = new ArrayList<Integer>();
lastDataMap = new HashMap<Byte, String>();
String serialPortName="";
if(baud > 0) {
this.baud = baud;
}
if (portName!=null && !portName.trim().isEmpty()) {
//open specific port
log.log(Level.INFO, "open port: {0}", portName);
serialPortName = portName;
openPort(portName, rainbowduinoAddr);
} else {
//try to find the port
String[] ports = Serial.list();
for (int i=0; port==null && i<ports.length; i++) {
log.log(Level.INFO, "open port: {0}", ports[i]);
try {
serialPortName = ports[i];
openPort(ports[i], rainbowduinoAddr);
//catch all, there are multiple exception to catch (NoSerialPortFoundException, PortInUseException...)
} catch (Exception e) {
// search next port...
}
}
}
if (port==null) {
throw new NoSerialPortFoundException("Error: no serial port found!");
}
log.log(Level.INFO, "found serial port: "+serialPortName);
}
But when i put
String portName = Serial.list()[2]; // my FTDI
rainbowduino = new Rainbowduino(this, i2cDest, portName);
i get a "No such method error" ![]()
01.02.2011 16:40:15 com.neophob.lib.rainbowduino.Rainbowduino <init>
INFO: Initialize neorainbowduino lib v1.7
Exception in thread "Animation Thread" java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z
at com.neophob.lib.rainbowduino.Rainbowduino.<init>(Unknown Source)
at com.neophob.lib.rainbowduino.Rainbowduino.<init>(Unknown Source)
at mousetotisch.setup(mousetotisch.java:51)
at processing.core.PApplet.handleDraw(PApplet.java:1583)
at processing.core.PApplet.run(PApplet.java:1503)
at java.lang.Thread.run(Thread.java:655)
Thanks for your help ![]()