There are a lot of controlling softwares for Arduino boards that you can use to connect a computer (linux, windows, android and so on) to your preferred Arduino. But I know just one controlling software that is able to control and coordinate many Arduino boards at the same time. It is Ardulink. With Ardulink you have at least two very high scalability options to achieve this result.
The first one is to connect several Arduino boards to a single PC, for instance with USB cables. An Ardulink based software (running in the same PC) have just to use several instances of Link class, one for each connected board.
This is a simple code snippet that show you how listen for a pin state change value from an Arduino board A and dispatch this value change event to two different Arduino boards B and C (from/to respectively pins 11,12 and 13).
private Link linkA; private Link linkB; private Link linkC; public void coordinate() { linkA = Link.createInstance("linkA"); linkA.connect("COM19"); linkB = Link.createInstance("linkB"); linkB.connect("COM20"); linkC = Link.createInstance("link3"); linkC.connect("COM21"); linkA.addDigitalReadChangeListener( new DigitalReadChangeListener() { @Override public void stateChanged(DigitalReadChangeEvent e) { linkB.sendPowerPinSwitch(12, e.getValue()); linkC.sendPowerPinSwitch(13, e.getValue()); } @Override public int getPinListening() { return 11; } }); }
The second one is to connect several Arduino boards to a single PC, for instance with USB cables and install into this PC the Ardulink Network Proxy Server. In this way another PC with an Ardulink based software can communicate with the Ardulink Network Proxy Server and drive it.
The snippet code could be very similar to the above one. You have just to specify a network connection instead of use the implicit default serial connection.
// Hostname=RaspberryHost, Hostport=4478 NetworkProxy connection = new NetworkProxy("RaspberryHost", 4478); Link networkLinkToRaspberry = Link.createInstance( "networkLinkToRaspberry" ,connection );
Of course you can mix these two options as you like. Let’s see an example scheme.
PC with an Ardulink based software controls directly three Arduino boards and indirectly other six Arduino boards connected with three Ardulink Network Proxy Server. Note that one of them is installed into an Raspberry PI system. I’ll report you in another article the amazing result for the Ardulink Network Proxy Server working test on a Raspberry PI.
Using a network connection is another very powerful Ardulink feature. You can coordinate many Arduino boards widely distributed into the net (even into a wireless net).
Here you can see another example video where Ardulink coordinates an Ardino UNO and Arduino Micro and a Digispark board.
to download videos source code examples click here: Coordination Examples
Hello,
I think that this code is not correct, you have to add a thread.sleep(2000); before the addDigitalReadChangeListener
Yes,
I agree. Thank you for your comment. Usually, when Ardulink connects with Arduino, Arduino reboots (it depends on which arduino compatible board you are using). So your code should waits some seconds waiting for Arduino reboot (2 seconds should be enough for Arduino UNO but some boards need for more time).
The addDigitalReadChangeListener made two actions:
If you don’t wait for some seconds the send message could be loss. So you should re-send the message with the Link class.
Is it possible for ardulink to communicate over I2C?
Actually Ardulink hasn’t support for I2C. However it could be extended but the right question is: where? If you search a way to use I2C on Raspberry PI then you could explore PI4J (as I did for the Raspberry Link) or maybe check pages like this: http://docs.oracle.com/javame/8.0/me-dev-guide/i2c.htm
If you search a way to use I2C on another system you should find a java library and integrate it with Ardulink. Could you explain better what do you need for?