/* Adaptics BT platform 11/11/11 persistent connection with a BT serial module this WAS working well with precompiled library and setting the baudrate artificially to 76800 (because F_CPU not working) although println(unsigned long) was causing an error. what's changed :-( 15/11/11 using 38400 and non precomiled- sucessfully enters inquiry can only seem to connect straight after pairing, which is annoying when connected the BT module sends some fragments of commands ie.e "+STOAU\0xf4" it only seems to stay connected for 1/2 second. Voltage issue? yep- it works on 0v-3v but ont on -3v-0v -3v seems to kind of work at 9600bps - received junk at 19200 it stays on for a few seconds but received junk */ #include "adapticsBT.h" void setupBlueTooth(){ pinMode(BTC,INPUT); //connection indicator Serial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400 Serial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode Serial.print("\r\n+STNA=AdapticsElectic\r\n"); //set the bluetooth name 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 //necessary? Serial.print("\r\n +STPIN=0000\r\n"); //"\r\n+DLPIN\r\n"); Serial.print("\r\n+LOSSRECONN=0\r\n"); //setting this to 1 seems to stop it working advertise(); } void advertise(){ delay(2000); // This delay is required - its really 2 seconds Serial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable delay(2000); // This delay is required. Serial.flush(); }