Hi everybody I'm a newbiee and I have a problem.
I'm trying to read the values of a pot from Arduino UNO using a Bluetooth shield (http://www.seeedstudio.com/depot/bluetooth-shield-p-866.html).
I can read the values if I open the serial monitor using COM3 (which is the USB COM I use to program the Arduino), but when I try to read the values using COM4 or COM6 (which are the COMs that the computer created when I paired the bluetooth shield), I can't see anything.
Here is my code:
#include <SoftwareSerial.h>
#define RxD 6
#define TxD 7
#define DEBUG_ENABLED 1
SoftwareSerial blueToothSerial(RxD,TxD);
int sensorPin = A0;
int sensorValue = 0;
void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();
}
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=OSC_BT_\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();
}
void loop()
{
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);
}
I hope somebody can help, I'd like to sleep tonight.
Thanks and sorry for my bad english.