Hey everyone,
I am trying to set up a connection between my arduino nano (3.1) and my mobile phone. I am not sure if I want to be able to program the board wireless yet as much as just being able to command it to control some basic functions to start. I am using the bluetoothbee as my module for my nano and excuse me if this is a dumb question, but will I need the shield as an intermediate between the two? And if so, what module or method could I use to bypass this? (I’m trying to put the module + board into something small so every cc counts) I found some wonderful tutorials here:
viewtopic.php?f=18&t=1283&p=4077&hilit=mobile+phone+bluetooth+arduino#p4077
and also the master slave tutorial which I have already read and am planning to use here:
viewtopic.php?f=4&t=687&hilit=bluetoothBee
I have yet to receive the bee yet but I am I good to go? or will I need to write code for any drivers? I am kind of new at this but I have a decent programming background as well as a above average knowledge of electronics. Any help will be greatly appreciated. Thank you guys
Jesse
So i ended up just getting the shield and connected them all together, however I ran into a pretty big road block that I would like some help on. Whenever I try to program the board and the bee together I get a protocol error saying that the programmer is out of sync. I read forums up and down and found out I needed to upload the code to the board without it attached, then hit reset on the board. This dodged the programming problem but when I hit the reset button on the board it doesn’t do anything. All I get is a flashing green light. What do I do to get this running? Btw the code im using to run a preliminary trial is the one found on the bluetooth bee wiki
#include <NewSoftSerial.h> //Software Serial Port
#define RxD 11
#define TxD 12
#define DEBUG_ENABLED 1
NewSoftSerial blueToothSerial(RxD,TxD);
void setup()
{
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()
{
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())
{
a = blueToothSerial.read();
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();
break;
}
if('K' == b)
{
break;
}
}
}
}
while( (a = blueToothSerial.read()) != -1)
{
//Wait until all other response chars are received
}
}
void sendBlueToothCommand(char command[])
{
blueToothSerial.print(command);
CheckOK();
}
ok I figured it out
Its pretty basic but for anyone who had the Arduino nano with the nano Xbee shield and the bluetooth bee make sure you set your
mySerial(RxD,TxD)
where RxD = 0 //digital pin 0
and TxD = 1 // digital pin 1
hopefully everything works smoothly after that
also you cannot upload the code with the bee attached. Load the code into arduino, reconnect the bee, then hit reset and that should get it going.