Forum >Changing BLE name with arduino code
Bluno General Arduino

Changing BLE name with arduino code

userHead stephen_ball1993 2016-01-24 18:53:18 5580 Views3 Replies
Hi,

I have a Bluno V2.0 and I am able to change the name of BLE by sending the AT+NAME command in the serial monitor successfully. However for my project I would like to be able to change the name regularly in the source code that I upload. Is this possible? I have tried using methods such as doing Serial.print("+++") and Serial.print("AT+NAME=name") but it does not work.

If someone could let me know if this is possible it would be great.
2016-01-26 23:34:12 I had a quick look at your code and I think you need to use an alternative function than "serial.print" as that just displays the information rather than talking to the hardware. perhaps serial read or serial write. I have edited the code slightly but I think it needs some more work

do some reading around these pages and they might give you some ideas on how to implement this function:

https://www.arduino.cc/en/Serial/Write
https://www.arduino.cc/en/Serial/Read
https://www.dfrobot.com/wiki/index.php/Bluno_SKU:DFR0267 (AT commands section)

Code: Select all
void setup() {
  pinMode(13, OUTPUT); // This the onboard LED
  pinMode(8, OUTPUT); // This is connected to the buzzer
  Serial.begin(115200);    //Initiate the Serial comm
  delay(1000);
  Serial.write("+++");   // Enter AT mode
//  Serial.print("+++");   // Enter AT mode
  delay(500); // Slow down and wait for connectin establishment
}

void loop() {
 
//Serial.println("AT+NAME=50");
  Serial.write("AT+NAME=50");
  delay(2000);

//Serial.println("AT+NAME=100");
  Serial.write("AT+NAME=100");
  delay(2000);

//Serial.println("AT+NAME=200");
  Serial.write("AT+NAME=200");
  delay(2000);
}
userHeadPic Maht
2016-01-26 04:49:55 I have had some luck getting the name to change using the same kind of method I was talking about, some of the syntax was incorrect. However my problem now is that the BLE name will only update on my mobile when I turn the bluno off and then back on. I was hoping the name would update without having to do this.

My code is shown below. I was expecting to see the name cycle through the values 50, 100 and 200 with 2 second intervals on my mobile but this is not the case.


Code: Select all
void setup() {
  pinMode(13, OUTPUT); // This the onboard LED
  pinMode(8, OUTPUT); // This is connected to the buzzer
  Serial.begin(115200);    //Initiate the Serial comm
  Serial.print("+");
  Serial.print("+");
  Serial.print("+");   // Enter the AT mode
  delay(500); // Slow down and wait for connectin establishment
 }


void loop(){

   Serial.println("AT+NAME=50");
   delay(2000);
   Serial.println("AT+NAME=100");
   delay(2000);
 
    Serial.println("AT+NAME=200");
   delay(2000);
 

}


void enterATMode(){
 
  Serial.begin(115200);    //Initiate the Serial comm
  delay(1000);
  Serial.print("+");
  Serial.print("+");
  Serial.print("+");   // Enter the AT mode
 
}

userHeadPic stephen_ball1993
2016-01-26 00:41:01 Hi there, thanks for your post

It should be possible to do this. I think your issue might be syntax-related...
Are you just using the serial print function or serial read as well?
Perhaps post your code and the intended function of it in the forum for us to see and we can help better

In the meantime these links may be of help:

http://stackoverflow.com/questions/1034 ... in-arduino
http://forum.arduino.cc/index.php?topic=145866.0

good luck!
userHeadPic Maht