Many of you are already aware of my project to replace all the switches and knobs of an electric guitar by digital circuitry controlled by an Android phone.
Well, thanks to many of you, I have reached a first milestone: I have a working
ArduGuitar!
You can read all about it on the
ArduGuitar Home Page but for those who want a quick overview here it is:
I ripped all the pots and switches out of an old Ibanez RG 140 guitar and put in a circuit that I made using vactrols and controlled by an Arduino, connected to my Android phone by a cheap JY-MCU bluetooth module.
On the phone I run some Processing code, using the the
Ketai library to handle the bluetooth coms.
This allows me to select pickups, change volume and tone, as well as record and activate "preset" configurations, e.g. the "Woman" config that Clapton made famous, by tapping on my phone velcro'd to the top of the guitar!
I ma trying to figure out the most appropriate implementation of comms via bluetooth using the Ketai library.
When I see the KetaiBluetooth::start() method, I imagine that the bluetooth object is in fact a separate thread? Is that correct?
When I want to write to the bluetooth device, should I spawn my own thread, to exit the main animation thread, or does the call 'KetaiBluetooth::writeToDeviceName(...)' already create a wake-up event on the Ketai thread?
I have implemented both versions but cannot tell from execution and traces what is going on, nor which is the appropriate implementation?
Well, just as I was about to ask a question, in total despair, as to how to save files on Android, I figured it out!
This is what I did and it works on my Nexus 4 (Jelly bean 4.2.2 not rooted):
skectch permission: WRITE_EXTERNAL_STORAGE
on the device, with a terminal app:
$ mkdir /sdcard/MyStuff
then, to write a file, it must look "external", think network address...
saveTable(tsv,"//sdcard/MyStuff/data.tsv");
note the use of leading double slash before the root of the path. For some incredible reason, this convinces Android OS that the path is external. If you don't put that extra slash, you get an error saying it is evil to put path separators in the file-path-name! If you just give a simple filename, then saveTable just fails silently, with no exception ...
I'm looking for a way to get a Processing script to read and write on /dev/rfcomm port (bluetooth). It is simply a serial protocol but the following code fails:
import processing.serial.*;
Serial myPort;
void setup() {
println(Serial.list()); // this returns nothing
String portName = "/dev/rfcomm0";
myPort = new Serial(this, portName, 9600); // this causes a null pointer exception
println(myPort);
myPort.write('x');
}
I can connect to /dev/rfcomm0 via PuTTY and communicate with no problem...
I am trying to perform serial communication on between Ubuntu 12.04 and a JY-MCU bluetooth serial module connected to an Arduino.
I have created this configuration in /etc/bluetooth/rfcomm.conf
rfcomm0 {
# # Automatically bind the device at startup
bind yes;
# # Bluetooth address of the device
device 00:12:11:19:08:54;
# # RFCOMM channel for the connection
channel 1;
# # Description of the connection
comment "Linvor Bluetooth Module";
}
I can use putty to communicate with the /dev/rfcomm0 serial port and this works perfectly.
However, despite many attempts I simply cannot see how to create a serial port in Processing that works in any way.
For example :
println(Serial.list());
prints nothing at all.
If I execute:
String portName = "/dev/rfcomm0";
myPort = new Serial(this, portName, 9600);
println(myPort);
I see this in the monitor:
processing.serial.Serial@1712651
But if I then call:
myPort.write('9');
I get an exception:
java.lang.NullPointerException
at processing.serial.Serial.write(Serial.java:572)
...
I can't understand why this fails. I have been following all the instructions from Tom Igoe's "Making Things Talk", but this just does not work the way he says...
Results: a slider event: 0.0 a slider event: 0.0 a slider event: 0.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0 a slider event: 5.0
I'm brand new to this world so I hope this newbie question isn't too silly.
I've built a GUI in G4P using the the gui builder and it works fine.
Now I want to have a listbox containing strings such that the user can:
select a single item (no multiple selection)
add/delete items
move items up/down
rename items
load a new set of items from a String list[]
I can't see how to do this in G4P.
Would anyone have a suggestion of what to do?
Thanks,
Bob