Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: January 16, 2008, 07:48:12 am
Hai,

You need to do this in the BT init sketch, you only need to do this once!
Code:
Serial.println("SET CONTROL ESCAPE 43 00 0");  

Normally the arduino starts in data mode to change to command mode you need to use this code;
Code:
delay(2000);  
Serial.print("+++");
delay(2000);

After that you can preform all the commands discribed in the manual from the WT11.
The serial connection between the ArduinoBT and the computer or other devices is used by the WT11 and the arduino. So you can't send data back to a computer when you are in command mode because the WT11 is using it to send the data to the Arduino. But you can save the data in a string or in the EEPROM.

When you are done in command mode you switch back to data mode by using the same code for switching to command mode. After that you can restore your connection with the PC and send the data from the string or from the EEPROM to the computer.

For as far as I know the ArduinoBT will not be rendered useless even if you make a mistake in the timing. When you reset the board it will work again and then you can change another timing. The only thing that you need to watch out for s not changing other things in the BT init sketch than mentioned above. Making a backup from the init sketch before you change everyting would be a good idea.
2  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: January 16, 2008, 07:06:01 am
For the INQUIRY you need to change from data to command mode. Are you sure you are changing on the right way from data to command mode and back? Before you can do that on the way I did that, you need to change some code in the BT ini sketch. You only need to do this once. Somewere in this forum stays how you need to do that.

All the data that you get when you are doing the INQUIRY you need to save in a string or in the EEPROM. After switching back from command mode to data mode you can send them back to PC. The other way is to hook up a LCD screen or something to show directly what you found.

Another important thing is the timing in the code between switching between data and comand mode and viceversa. Check the manual from th WT11 for details.

Hopes this helps.
3  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 24, 2007, 03:05:02 am
I think that the problem is the serial buffer. I found out that the serial buffer is 128 characters big. I'm not sure of the ArduinoBT in command mode can save characters out off the serial buffer in the mermory of the chip. If that's not a problem then it should not matter if you save the data in the eeprom like you do or in a string like I did. Hopes this will help.

Has somebody tried to get the serial buffer bigger and how does this go?
4  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 21, 2007, 06:06:37 pm
When you get it working please let me now.
Thanks in advance!
5  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 21, 2007, 04:57:15 pm
At least I've got it working, here is the code:

#include <TextString.h>

int ledPin = 13;                // LED connected to digital pin 13
int resetPin = 7;                  // BT module uses pin 7 for reset
char inByte = 0;                // incoming serial byte
TextString incomingString = TextString(100);

void setup()                    // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  pinMode(resetPin, OUTPUT);
  Serial.begin(115200);        // start serial at 115200 kbs
}

void loop()
{
  // if we get a valid byte, read analog ins:
  if (Serial.available() > 0) {    
    inByte = getbyte();  // get incoming byte
    if (inByte == '&' ) { // look for a &
      getInfo();
    }else if (inByte == '@' ) { // look for a 0
      digitalWrite(ledPin, LOW); // set led LOW
      Serial.print("Get string:  ");
      Serial.println(incomingString.getArray()); //print string
      Serial.println("Cleared string");
      incomingString.clear(); // empty string
    }else{
     saveCharToString(inByte); // no right char then save it to sting
    }              
  }
}

void getInfo()
{
  digitalWrite(ledPin, HIGH); // set led HIGH
  delay(2000);
  Serial.print("+++");
  delay(2000);
  Serial.println("INQUIRY 5");
  for (int i=0; i <= 10; i++){
      delay(1000);
      while (Serial.available() > 0) {    
        inByte = getbyte();  // get incoming byte    
        saveCharToString(inByte); // no right char then save it to sting
      }
      delay(1000);
   }
   delay(2000);
  Serial.print("+++");
  delay(2000);
  digitalWrite(ledPin, LOW); // set led low
}

char saveCharToString(char inByte)
{
   incomingString.setCharAt(incomingString.length(), inByte); // save char to string at last position
}

char getbyte()
{
   while (Serial.available() == 0) { //look for aviable data
     // do nothing, wait for incoming data
   }
   return Serial.read(); //return data if aviable
}


When you send in the serial monitor from arduino the symbol "&", the Arduino BT will start an INQUIRY.
A led will blink that is connected on port 13. When the led go's off the INQUIRY is ready.
You can send then a "@" to get the data back in the serial monitor.

Thanks all for your help!
6  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 21, 2007, 07:43:47 am
Could somebody help me with example code for switching from data to command mode.
Preforming a command like the call or inquiry command and then switching back to the data mode?

7  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 21, 2007, 06:27:24 am
So multiplexing will not work.
Can somebody help me with the right settings for the control echo.
I think that I don't do it on the right way.
8  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 21, 2007, 05:09:07 am
Is it possible to use the multiplexing mode to control the IWRAP module and the computer at the same time?
9  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 19, 2007, 06:52:12 am
Thanks for your response!

I'm trying to get the first option working. Sending the escape command has worked. But then I get a problem with saving all the incoming data. I think the problem is that I never know how much data is comming back, so that I can save it in a sting and send it later back to the computer. I'm also not sure about when the INQUIRY has ended so that I can send again the escape command and send the data back.

Could you help me with those problems?

Thanks!
10  Forum 2005-2010 (read only) / Interfacing / ArduinoBt searching for other BT devices on: June 14, 2007, 07:51:11 am
Hi all,

I've a quistion; has somebody used the INQUIRY command that is in the IWRAP manual?
I'm trying to use it to search for other devices in teh area and save the Bluetooth adresses in a array, but I don't get the information back to the arduino or to processing. Could somebody give me a lead were to search for more information or a good example how to use the commands from the manual on the way that I could use the information that I get back from the bluetooth module.

Thanks in advance.

Gr... Arjen
11  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBT using the CALL function on: August 30, 2007, 10:24:27 am
Hey all,

at this moment I'm working on a tutorial with as topic using the ArduinoBT module.
In this tutorial I will show how to use commands like call, list, inquiry, select and close.

Can somebody tell me where I can post this tutorial?

Gr... Arjen
12  Forum 2005-2010 (read only) / Interfacing / ArduinoBT using the CALL function on: August 16, 2007, 03:26:03 am
Hi All,

I'm trying for a long time to get the CALL function working to make it possible to connect two ArduinoBT modules.
The Call function is working between PC and one ArduinoBT. For a strange reason I need to change ports when I call from the Arduino to the PC.

The problem is that I still don't get the connection between the ArduinoBT's working. I use this code to connect to an arduinoBT module.

Code:
void callF(){
  if(fO == 0){
    for(int g=0; g<7; g++){
      if(kBTn[g][1] == 1 && kBTn[g][2] == 2){
         inS.clear();
         fO = 2;
         outP(2, 500, 500, motor);
         outP(2, 500, 500, statusLED);
         Serial.print("+++");
         outP(4, 500, 500, statusLED);
         Serial.print("CALL ");
         Serial.print(kBTa[g]);
         Serial.print(" 1 RFCOMM");
         Serial.println("");  
         outP(1, 10000, 0, statusLED);  
         outP(2, 500, 500, statusLED);
         Serial.print("+++");
         outP(4, 500, 500, statusLED);
         getSt(); // get the complete serial buuffer into the sting inS
         Serial.println(inS.getArray());   // prints the string inS  
      }
    }
  }
  inS.clear();
}

This code I use to connect from an ArduinoBT module to my PC.
Code:
void callM(){        
         outP(2, 500, 500, statusLED);
         Serial.print("+++");
         outP(4, 500, 500, statusLED);
         outP(1, 10000, 0, statusLED);
         Serial.println("CLOSE 0");
         outP(1, 10000, 0, statusLED);
         Serial.println("CALL 00:16:41:ca:80:d9 1 RFCOMM");
         //Serial.println("");  
         outP(1, 10000, 0, statusLED);  
         outP(2, 500, 500, statusLED);
         Serial.print("+++");
         outP(4, 500, 500, statusLED);
         getSt(); // get the complete serial buuffer into the sting inS
         Serial.println(inS.getArray());   // prints the string inS  
         Serial.println("*");
}

void outP(int t, int on, int of, int p){
  for(int i=0; i <= t; i++){
    digitalWrite(p, HIGH);
    getSt();
    if(fO == 0){
      cFc();
      coOs();
    }
    delay(on);
    digitalWrite(p, LOW);
    delay(of);
  }
}

I hope that somebody can help me with this problem. When I get the call function working I will try write  tutorial about this topic.

Thanks!
13  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino BT Bootloader/Connection Problem on: June 29, 2007, 09:00:24 am
@ bigengineer

Thanks for your help! Have compiled the sketch and uploaded to mine board. Indeed teh name has changed. The led blinks and in the serial monitor I get ciao!. So the sketch is working. But I still can't program the Arduino BT from the Arduino IDE.

Can you tell me your fuses settings and lockbit settings after programming the devices?

Mine are for the fuses: 0xF8, 0xDF, 0xFF
and the lockbits:  0xCF

The arduino IDE gives me this error: [VP 1] Device is not responding correctly.
14  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino BT Bootloader/Connection Problem on: June 29, 2007, 07:17:22 am
@ bigengineer

I could not find the BT_init program. Is that the normal bootloader, because the normal bootloader doesn't the job.
I have checked the lockbits and fuses settings, but still I can't program the boards from the Arduino IDE.
15  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino BT Bootloader/Connection Problem on: June 28, 2007, 02:52:37 pm
The strangest thing is that I can program both with the AVR studio 4 software.
It reacts on the new sketches, but still I'cant program them in the Arduino IDE.
Pages: [1] 2