ARDUINO BLUETOOTH - send data only after reset

BT problems!
Running OSX 10.4.8 and 009 IDE version,
power the board with 5,5 V (+/- 0.2 V),
using a Sharp IR range sensor on analog input 0.

I can easily pair the BT board and managed to read analog input data from the IDE serial monitor,
but ONLY IF I open the serial monitor RIGHT AFTER hardware resetting the board with the switch,
just as you do to upload code to the board.
If I power the board and try to open the serial monitor after, say, 5 seconds, I got the discouraging message:

Error inside Serial.()
gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
etc…

I need to place 2 BT boards far away from the pc so I can’t push the reset button on the boards
everytime I want to start the serial communication.
I don’t think it’s a power issue, coz once it’s connected and going, it’s stable for hours and hours
(tried to keep it working all night long and the board behaved perfectly).

Is there a known solution to this problem?
I’ve seen that the Diecimila board has a sort of automatic reset switch
and that maybe even the BT board can be modified, but I’m a bit afraid of frying everything!!!

Another Bt related question:
can I render the BT board invisible to other devices other than my computer?
I don’t want people try to connect to the board while it’s working!
even if they can’t acces it I suppose that the connection BTboard<->Computer
could be affected by, say, cellphones or laptops in the area trying to connect to the BTboard…

Sorry for cross-posting this message in many sections of the forum!
Any help would be REALLY appreciated,
have bright days,
gio

You might try to setup a connection with screen: screen /dev/cu.your_arduinoBT_name 115200

I don't have this problem but I am still on arduino 8.

Do you have a part of the BT init code in your program? Maybe that messes things up. So, you can only connecto right after the bootloader stops and just before the init code runs.

If you read the iwrap manual you will find the commands to make the BT invisble I think.

Sorry for cross-posting this message in many sections of the forum!

yeah, there's no need to spam the forum: it's not that big of a place!

To answer one of your questions, you can set a unique pass-code for each BT module, see the tutorial in the playground.

D

Thanks for the quick reply!
Well, the code is really simple (see at the bottom of this post)
I didn’t use any BT instruction, only analog read from pin 0,1,2
and write the values to serialport with a prefix to identify the pins.

Lookig at the Arduino BT Initialization Sketch
http://www.arduino.cc/en/Main/ArduinoBTInitializationSketch

digitalWrite(RESET, HIGH);
delay(10);
digitalWrite(RESET, LOW);
delay(2000);

why is there a reset there? it seems that I can open a connection only during that
“delay(2000)”, and when it restarts I can’t connect anymore. Could be this?
Sorry for my incompetence!!!

Is there an application for winzozz-osx that can show the actual data-text-information exchanged between the iwrap<->pc,
a sort of bluetooth debug utility that can help to understand what’s going on in those precious milliseconds?

Thanks a lot for your support,
bless,
gio

/*

+++ SHARP GP2D12 IR range finder +++

  • Sensors are connected to arduino ANALOG (A=0 B=1 C=2)

*/

int SignalA = 0; // Sensor A signal pin ANALOG-0
int valA = 0;
int ValueA = 0;

int SignalB = 1; // Sensor B signal pin ANALOG-1
int valB = 0;
int ValueB = 0;

int SignalC = 2; // Sensor C signal pin ANALOG-2
int valC = 0;
int ValueC = 0;

void setup() {
beginSerial(115200); // Sets the baud rate to 115200 for ARDUINOBT
pinMode(SignalA, INPUT); // Switch signalpin ANALOG-0 to input
pinMode(SignalB, INPUT); // Switch signalpin ANALOG-1 to input
pinMode(SignalC, INPUT); // Switch signalpin ANALOG-2 to input
}

void loop() {
valA = 0;
valB = 0;
valC = 0;
valA = analogRead(SignalA); // Append signalA value to valA
valB = analogRead(SignalB); // Append signalB value to valB
valC = analogRead(SignalC); // Append signalB value to valC

/* Writing out values to the serial port


*/

ValueA = valA; // Append analog read A to ValueA
serialWrite(‘A’); // identifier for the sensor A
printInteger(ValueA);
serialWrite(10);
serialWrite(13);
delay(20);
ValueB = valB; // Append analog read B to ValueB
serialWrite(‘B’); // identifier for the sensor B
printInteger(ValueB);
serialWrite(10);
serialWrite(13);
delay(20);
ValueC = valC; // Append analog read C to ValueC
serialWrite(‘C’); // identifier for the sensor C
printInteger(ValueC);
serialWrite(10);
serialWrite(13);
delay(20);

/* Delay of program


*/
delay(20);
}

Is this your actual code? does beginSerial still work instead Serial.begin for instance? Or Serialwrite? This seems like very old code.

yes, it is old code I had used in the past years, just to make a quick test of the BTboard,
I tried to replace
beginSerial with Serial.begin
and
Serialwrite with Serial.print
: nothing has changed, it worked before and it works now,
but only if you start serial monitor right after resetting the board,
otherwise same old red message:
Error inside Serial.()
gnu.io.PortInUseException: Unknown Application

Dunno if it’s because something wrong I do,
I’ll let you know if I manage to solve this,
if anyone got a clue please help!
thanks for your patience and attention,
bless,
gio