Hi!
I want to use this A6 GSM library. I have tried it with Arduino Leonardo and it works great but now I want to use it with Arduino MEGA. In the A6lib.cpp and A6lib.h I changed every SoftwareSerial to HardwareSerial but it is not working. Can you look into A6lib.cpp and A6lib.h that I posted in the attachments to see where I have made a mistake? Here is my code that works on Arduino Leonardo.
#include <A6lib.h>
#define D0 9
boolean SMS1 = false;
// Instantiate the library with TxPin, RxPin.
A6lib A6l(Serial1);
int unreadSMSLocs[30] = {0};
int unreadSMSNum = 0;
SMSmessage sms;
void setup() {
pinMode(10,INPUT);
pinMode(13,OUTPUT);
Serial1.begin(115200);
// Power-cycle the module to reset it.
A6l.powerCycle(D0);
A6l.blockUntilReady(9600);
digitalWrite(13,HIGH);
A6l.sendSMS("*********", "Start");
}
void loop() {
if (digitalRead(10) == HIGH && SMS1 == false) {
digitalWrite(13,HIGH);
A6l.sendSMS("*********", "Pin 10, HIGH");
SMS1 = true;
}
if (digitalRead(10) == LOW) {
SMS1 = false;
digitalWrite(13,LOW);
}
}
A6lib.cpp (11.7 KB)
A6lib.h (2.19 KB)
"it is not working" is not very helpful and could use further explanation.
vaj4088:
"it is not working" is not very helpful and could use further explanation.
Thank you for your reply. While uploading the sketch I get errors:
eweew:6: error: no matching function for call to 'A6lib::A6lib(HardwareSerial&)'
A6lib A6l(Serial1);
^
/Users/***/Documents/Arduino/eweew/eweew.ino:6:18: note: candidates are:
In file included from /Users/***/Documents/Arduino/eweew/eweew.ino:1:0:
/Users/***/Documents/Arduino/libraries/A6lib-master/A6lib.h:71:5: note: A6lib::A6lib(int, int)
A6lib(int transmitPin, int receivePin);
^
/Users/***/Documents/Arduino/libraries/A6lib-master/A6lib.h:71:5: note: candidate expects 2 arguments, 1 provided
/Users/***/Documents/Arduino/libraries/A6lib-master/A6lib.h:69:7: note: constexpr A6lib::A6lib(const A6lib&)
class A6lib {
^
/Users/***/Documents/Arduino/libraries/A6lib-master/A6lib.h:69:7: note: no known conversion for argument 1 from 'HardwareSerial' to 'const A6lib&'
exit status 1
no matching function for call to 'A6lib::A6lib(HardwareSerial&)'
I have changed the .cpp and .h files and I can upload the sketch successfully but still the module is not working.
A6lib.cpp (11.7 KB)
A6lib.h (2.18 KB)