Go Down

Topic: GSM library Serial suggestion (Read 846 times) previous topic - next topic

technix

Dec 14, 2014, 08:34 pm Last Edit: Dec 14, 2014, 08:35 pm by technix
Reading through the introduction page for GSM shield, I have a feeling that it should not come with a library that forces the use of SoftSerial. It should be easy to modify it into using both Serial and SoftSerial.

With this new library the user is required to initialize a Serial interface for GSM library and provide a reset pin with it:
Code: [Select]
// Prototype
void GSM::begin(Stream serial, uint8_t pin);

// Leonardo, Mega or Due, using a hardware serial for GSM:
GSM.begin(Serial1, 7);

// Mega or Due, two GSM shields:
GSM GSM1();
GSM.begin(Serial1, 7);
GSM1.begin(Serial2, 10);

// Or good old SoftSerial on Uno:
SoftwareSerial gsmSerial(2, 3);
GSM.begin(gsmSerial, 7);


This will allow better communication between GSM and microcontroller when a hardware serial interface is available.

jot4p

What file do I put this? gsm.h?

Go Up