After searching high and low, I have made this work.
The key issue is that processing uses the rxtx java library (RXTX-2.1-7) for serial communications.
The RXTX wiki says:
The trick is to create a sym link to fool rxtx (use a ttyS device that is not yet assigned):
To summarize, the following process will allow a processing script to communicate via a serial port with a JY-MCU device in a BlueZ linux framework
One time setup:
1. power up the JY-MCU,
2. use the following command to get its hardware address, mine is 00:12:11:19:08:5
we need that for connection later:
That ends the one-time setup.
Then, every time you want to use the JY-MCU
1. create the sym link:
command line to disconnect the JY-MCU.
That should do it!
Ciao,
Bob
The key issue is that processing uses the rxtx java library (RXTX-2.1-7) for serial communications.
The RXTX wiki says:
And since the bluetooth device is named rfcomm* it cannot be detected."rxtx tries to detect ports on by scanning /dev for files matching any of a set of known-good prefixes, such as 'ttyS', 'ttym', and since 2.2 'ttyUSB' and so on. "
The trick is to create a sym link to fool rxtx (use a ttyS device that is not yet assigned):
- $ sudo ln -s /dev/rfcomm0 /dev/ttyS99
- $ sudo rfcomm connect 0
- Connected /dev/rfcomm0 to 00:12:11:19:08:54 on channel 1
- Press CTRL-C for hangup
- println(Serial.list());
- [0] "/dev/ttyACM0"
- [1] "/dev/ttyS99"
To summarize, the following process will allow a processing script to communicate via a serial port with a JY-MCU device in a BlueZ linux framework
One time setup:
1. power up the JY-MCU,
2. use the following command to get its hardware address, mine is 00:12:11:19:08:5
- $ hcitool scan
we need that for connection later:
- $ cat /etc/bluetooth/rfcomm.conf
- rfcomm0 {
- bind yes;
- device 00:12:11:19:08:54;
- channel 1;
- comment "Linvor Bluetooth Module";
- }
That ends the one-time setup.
Then, every time you want to use the JY-MCU
1. create the sym link:
- $ sudo ln -s /dev/rfcomm0 /dev/ttyS99
- $ sudo rfcomm connect 0
- Connected /dev/rfcomm0 to 00:12:11:19:08:54 on channel 1
- Press CTRL-C for hangup
- String portName = "/dev/ttyS99";
- myPort = new Serial(this, portName, 9600);
command line to disconnect the JY-MCU.
That should do it!
Ciao,
Bob