Go Down

Topic: How do I change the baud rate? (Read 6412 times) previous topic - next topic

robtillaart

Quote
I only have 1 Serial port. GSM shield uses pin number 2 and 3.

That means you hardware serial port (pin 0 and 1 ) uses the BLE right?

The GSM shield uses pin 2,3

So you only need to set the baud rate once for the BLE (115200) and once for the GSM (9600)

I'll do a quick scan of your code (I'll be back ;)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

robtillaart


I see that PINNUMBER is defined as an empty "" -> I think a number should be in probably 2 or 3
#define PINNUMBER ""


Also your code has much comments that do not add value ==> remove it as it will only distract.
usage of better variable /function names makes most comments obsolete

//GSM gsmAccess;  <<<<<<<<<<<<<<<<< no value as it just is an echo of the line beneath
GSM gsmAccess(true);


char remoteNum[20] = "98997412";  // telephone number to send sms
so why not
char telephoneNumber[20] = "98997412"; 
no comments needed as the code becomes self explaining.


char txtMsg[200] = "Your device is out of range."; //sms content <<<<<<<<<<<< ??
==>
char smsContent[200] = "...";
or
chat textMessage[200] ...


  slaveConfiguration(); //BLE configuration for slave
==>
  BLEslaveConfiguration();

etc


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

visualxl

Yes you are right on that. Pin 0 and 1 is for the BLE.

Quote

So you only need to set the baud rate once for the BLE (115200) and once for the GSM (9600)


So, how do i do that ya especially for the GSM shield?

robtillaart

Quote

Quote
So you only need to set the baud rate once for the BLE (115200) and once for the GSM (9600)

So, how do i do that ya especially for the GSM shield?


as I said
Quote

I see that PINNUMBER is defined as an empty "" -> I think a number should be in probably 2 or 3
#define PINNUMBER ""


what GSM library do you use?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

visualxl

That is not right.

Code: [Select]

PINNUMBER = ""; //PIN on the SIM card if there is. Optional.


I am using this GSM library.

http://arduino.cc/en/Reference/GSM

fungus


The GSM is already using a SoftwareSerial internally on Pin number 2 and 3. Otherwise, It won't be able to send the SMS right? :)


So...you don't actually need to change the baud rate at all.

GSM does its own thing - you don't control it.

BLE needs 115200 which you can do once in setup().
Advanced Arduino

visualxl

That's what I don't understand.

If I set the Serial to 115200, I cannot configure or make the GSM work ~ T_T

fungus


That's what I don't understand.

If I set the Serial to 115200, I cannot configure or make the GSM work ~ T_T


OK, so that's what you need to figure out...

Advanced Arduino

robtillaart

looked in the GSM lib (oops its huge...)

if your board is a UNO (??)  it seems that the GSM uses a own soft-serial implementation to escape certain bytes.
This library is automatically initialized to 9600 baud if I understand code correctly.
So you do not need to set the baud rate yourself.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

visualxl

Yeap. We are on the same channel.

I just got it to work on Serial 115200. I think it may be good that I share this here. See if it may help others or not.

My purpose is to send an SMS once if RSSI is 0. Lemme clear a couple of stuff first with my superiors. :)


Go Up