My objective is to run the Touche for Arduino (guino version) outlined here http://www.instructables.com/id/Touche-for-Arduino-Advanced-touch-sensing/
Over a bluetooth serial port provided by the SeedStudio Bluetooth Shield http://www.seeedstudio.com/wiki/Bluetooth_Shield
The reason for doing this is mainly to isolate ground for the touch sensing. This will make the sense lead responsive only to the ground lead coming from the Arduino. Some of the gestures suggested in the Disney Touche demonstration are not possible with the Arduino implementation because of this grounding problem. There are many possible uses for this new configuration. Ground could be isolated by using a usb to serial isolated converter. However a device like this still has considerable capacitance coupling between earth ground and the isolated ground so better performance will be achieve by using wireless communication.
I have successfully executed the instructable for the disneyTouchGuino.ino (linked above), I have also successfully run the slave.pde example for the bluetooth shield and established working connection to my PC (paired and connected). This example program can be downloaded here http://www.seeedstudio.com/wiki/images/3/30/BluetoothShieldDemoCode.zip you will also need the software serial library here http://arduiniana.org/NewSoftSerial/NewSoftSerial10c.zip
The Guino_library.ino (downloaded from the aforementioned instructable) uses the hardware serial ports (0,1) running at 115200 baud. So I changed the jumper locations on the bluetooth shield so that the hardware serial ports are being used to communicate with the bluetooth shield. I also edited the slave.pde code to change the baud rate of the bluetooth shield to 115200 (from default 38400). Again I got the slave.pde up and running (paired and connected) with my PC talking at 115200 baud over bluetooth. So now I have the bluetooth connection figured out working code below. I'm not sure it's required but I have been using the in-system-programmer for all my Arduino programming uploads.
void setup()
{
Serial.begin(38400); //by default bluetooth shield is setup with 38400 baud
Serial.print("\r\n+STBD=115200\r\n"); //this changes baud to 115200 this change is remembered after power off so don't forget what you set this to
Serial.flush(); //if you do not include this the baud change will not be successful
Serial.begin(115200); //change your hardware serial baud rate so that you can continue configuring the shield
Serial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
Serial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
Serial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
Serial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
Serial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
//Serial.println("The slave bluetooth is inquirable!");
delay(2000); // This delay is required.
Serial.flush();
}
Finally I edit the function gbegin(...) in the Guino_library.ino to setup and utilize a bluetooth serial port (code below). I add a while loop to prevent any further program execution until the bluetooth is fully paired and connected to the PC. This is where I'm stuck. If I open the connection on a serial monitor I see some garbage characters come in which I assume is some dashboard configuration data for the Guino application, either that or it's some binary data sent by the EasyTransfer protocol that Gunio relies on. So I believe that the connection is successful however if re-initialize everything and try making the connection again using the Guino application it will not connect - it doesn't even send an inquiry to the bluetooth shield (ie. the red and green continue blinking).
Any suggestions on what might be going on here, how do I even debug this without getting into the source code of the Guino application?
void gBegin(int _eepromKey)
{
// Sets all pointers to a temporary value just to make sure no random memory pointers.
for(int i = 0; i < guino_maxGUIItems; i++)
{
guino_item_values[i] = &gTmpInt;
}
eepromKey = _eepromKey;
gInit(); // this one needs to run twice only way to work without serial connection.
internalInit = false;
//Serial.begin(38400); //baud already set to 115200
//Serial.print("\r\n+STBD=115200\r\n"); //baud already set to 115200
//Serial.flush(); //baud already set to 115200
Serial.begin(115200);
Serial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
Serial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
Serial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
Serial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
Serial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
//Serial.println("The slave bluetooth is inquirable!");
delay(2000); // This delay is required.
Serial.flush();
int val = 0;
while(val < 500){
val = analogRead(A1);
delay(1000);
}
ET.begin(details(guino_data), &Serial);
gSendCommand(guino_executed, 0, 0);
gSendCommand(guino_executed, 0, 0);
gSendCommand(guino_executed, 0, 0);
gSendCommand(guino_iamhere, 0, 0);
}