i2c in Java

Hi, this is my first post on arduino forum.

I'm building an led rgb controller that will have program written in java that go with it. Controller will have 100+ digital i/o and 20+ analog i/o and i'm planing to expand ports on arduino with MCP23017 chip that need to communicate with arduino on i2c protocol. For comunication with chip i use Wire library in sketch.

Is there any way to communicate with MCP23017 on i2c from java?

What computer will the Java code be running on?

(Hint - it won't be an Arduino)

...R

It will run on Windows

deluxe0507:
It will run on Windows

Then it won't communicate with the Arduino using I2C.

I don't understand, can you explain a bit more? Is it possible to do that with some other techniques, or other language like C++?

Do you know what I2C communication means? I2C is how two chips on the same board communicate, not how two computers communicate.

Yes i know what i2c communication means, but maybe i didn’t explain well enough what i’m trying to do.

I have arduino connected via usb to a windows pc. Arduino is getting audio signal from audio input circuit, then sending that signal to java program for fft analysis and beat detection, after beat is detected java program sends signals to arduino to fire up the led strip. For now that’s working fine, now i want to build hardware controller to control my java program. On controller i will have lots of push buttons for controlling and lots of led of status of each button(control) and for that i need lots of digital i/o. As i mention earlier for expanding ports i will use MCP23017. What i want to say is that push buttons and LEDs will be connected to MCP23017. Now i need a way to access MCP23017 and ultimately to access buttons and LEDs values from java.

From ardiuno sketch i access MCP23017 like this

Wire.beginTransmission(0x20);
Wire.write(0x12); // address port A
Wire.write(204); // value to send
Wire.endTransmission();
Wire.beginTransmission(0x20);
Wire.write(0x13); // address port B
Wire.write(136); // value to send
Wire.endTransmission();

and i need the to do that from java.

Now i need a way to access MCP23017

From what program? Accessing the MCP23017 is the Arduino’s job. It can share what it learned from the MCP23017 with any program that care, by sending data over the serial port.

But, I suspect that the Arduino is already doing all that it can, processing audio data.

From what program?

From my java program that i'm writing. Ardiuno already communicate with it over usb, and now i want to access MCP23017 through arduino from that program.

by sending data over the serial port.

can i acces that data using Ardulink?
I'm going to need to specify address of MCP23017 like this
Wire.beginTransmission(0x20);

But, I suspect that the Arduino is already doing all that it can, processing audio data.

Aurduino is accepting audio signal from audio input circuit and sends to pc, then audio processing is done on pc.

Something like this http://playground.arduino.cc/Main/MCP23S17 but the class provided is in c++ i need something like that for java.

Aurduino is accepting audio signal from audio input circuit and sends to pc, then audio processing is done on pc.

Showing some code would be far more effective than this hand-waving.

That class you linked to is for use on the Arduino WHERE THE HARDWARE IS CONNECTED. It is NOT meant for use on the PC.

Ok, this is my code http://pastebin.com/7YWqTkvC i used processing inside java (i started in processing then idea evolved). Arduino is running StandardFirmata.

Arduino is running StandardFirmata.

Firmata hasn't a clue how to deal with an MCP23017, so your java app will need to bit-bang the appropriate pins to emulate I2C. Good luck with that.

I can't believe that pulling data from the Arduino, using Firmata, is fast enough to get useful audio data.

I will get rid of Firmata and try using Ardulink for communication between Arduino and java. Thanks for suggestions.