[SOLVED]Seeeduino Stalker v2.2 / Bluetooth Bee access prob

Hi there.
I’m quite new to the arduino programming. I am using a Seeeduino Stalker v2.2 with a Bluetooth Bee module placed directly on the bee series socket on the stalker. the board is connected to pc via uartsbee:
20121023_133825[1].jpg

I tried that wiki sample code:

[code]

#include <SoftwareSerial.h> //Software Serial Port
#define RxD 11
#define TxD 12

#define DEBUG_ENABLED 1

SoftwareSerial blueToothSerial(RxD,TxD);

void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();

}

void loop()
{
//Typical Bluetoth command - response simulation:

//Type ‘a’ from PC Bluetooth Serial Terminal
//See Bluetooth Bee - Wiki for instructions

if(blueToothSerial.read() == ‘a’)
{
blueToothSerial.println(“You are connected”);
//You can write you BT communication logic here
}

}

void setupBlueToothConnection()
{
Serial.print(“Setting up bluetooth bee…”);
blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
delay(1000);
sendBlueToothCommand("\r\n+STWMOD=0\r\n");
sendBlueToothCommand("\r\n+STNA=SeeeduinoBluetooth\r\n");
sendBlueToothCommand("\r\n+STAUTO=0\r\n");
sendBlueToothCommand("\r\n+STOAUT=1\r\n");
sendBlueToothCommand("\r\n +STPIN=0000\r\n");
delay(2000); // This delay is required.
sendBlueToothCommand("\r\n+INQ=1\r\n");
delay(2000); // This delay is required.
}

//Checks if the response “OK” is received
void CheckOK()
{
char a,b;
while(1)
{
if(blueToothSerial.available())
{
Serial.print(“Available…”);
a = blueToothSerial.read();
Serial.println(a);
if(‘O’ == a)
{
// Wait for next character K. available() is required in some cases, as K is not immediately available.
while(blueToothSerial.available())
{
b = blueToothSerial.read();
Serial.println(b);
break;
}
if(‘K’ == b)
{
break;
}
}
}

}
Serial.print(“Ok”);
while( (a = blueToothSerial.read()) != -1)
{
//Wait until all other response chars are received
}
}

void sendBlueToothCommand(char command[])
{
Serial.print(command);
blueToothSerial.print(command);
CheckOK();
}[/code]

maybe you can guess that it did not work. Output:

Unbenannt.PNG (resettet stalker one time…)

I’m not quite sure - i guess i might use the wrong pins (although i am confused why i pass that .available() then?). Can somebody tell me whether this is the problem (and how to solve it) - or what else might be the problem…

Update 25/10/12 10:29:
Studying the schematics I think that I have to use PD0 (Pin1) for RXD and PD1 (Pin2) for TXD in this scenario (right?). Updated my code to the pins 1 and 2.
now im getting this output…:

output_p1_p2.PNG

After that it infinitely outputs “Available…x”

what am i doing wrong…? Pls help.

Thanks in advance,
apbs

Okay - problem solved.

for everyone who is interested:

first the right pins were 0 and 1. these pins the onboard bee socket is connected to. but that was part of the problem - the serial communication with the pc (connected with uarts bee / usb) ALSO uses pin 0 and 1 for the communication. so u CANT talk to bee on bee socket while connected to pc. one approach could be to do some wiring to connect the bee to for example pin 2/3 or - what i did - i dont use serial communication to the pc anymore. disconnected after uploading the programm -> using battery -> works as intended on pin 0 and 1.

=> solved :slight_smile: