After some time i trying to get the SeedStudio BT interface working again.
Uploaded the following sketch:
/* Upload this sketch into Seeeduino and press reset*/
#include <SoftwareSerial.h> //Software Serial Port
#define RxD 6
#define TxD 7
#define DEBUG_ENABLED 1
#define PIN_TEMP A1
SoftwareSerial blueToothSerial(RxD,TxD);
int getTemp()
{
int a = analogRead(PIN_TEMP);
int B=3975;
float resistance = (float)(1023-a)*10000/a;
float temperature = temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;
return (int)temperature;
}
void setup()
{
Serial.begin(19200);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();
}
void loop()
{
char recvChar;
while(1)
{
if(blueToothSerial.available())
{//check if there's any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
Serial.print(recvChar);
if(recvChar == 't' || recvChar == 'T')
{
blueToothSerial.print("temperature: ");
blueToothSerial.println(getTemp());
}
}
if(Serial.available())
{//check if there's any data sent from the local serial terminal, you can add the other applications here
recvChar = Serial.read();
blueToothSerial.print(recvChar);
}
}
}
void setupBlueToothConnection()
{
blueToothSerial.begin(38400); // Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n"); // set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=ArduKMoto\r\n"); // set the bluetooth name as "SeeedBTSlave"
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
blueToothSerial.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.
blueToothSerial.flush();
}
I do get the message that the device is inquirable but i cant see it on my phone or laptop.
Can see the laptop on the phone and the phone on the laptop.
The green led is flashing at a one second inter-fall. Any idee how to solve this problem?
Harry