Hi all
I just received my A6 GPRS module. I inserted a sim code and tried to send an SMS.
I found some scripts on the internet. They ran okay.
When I tried to send an sms, I got CME 58 error. I found out that this was due to a pin lock on the sim card.
Using AT+CPIN=XXXX (where XXXX was the sim code) in the serial monitor, it gave some output I didn't understand, but however, thereafter I could send an sms-message.
Is it possible to 'run' that code without typing it in the serial monitor ? If yes, how should I enter this as a command (as AT+CPIN=xxxx is not recognized as an Arduino commando).
The code I am using is written below.
Thanks for any help.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // TX-Pin11, RX-Pin10
void updateSerial()
{
delay(2000);
while (Serial.available()) {
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available()) {
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}}
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}void loop()
{
mySerial.println("AT"); // Once the handshake test is successful, it will back to OKupdateSerial();
mySerial.println("AT+CMGF=1"); // Configuring mode is TEST, only English texts are available
updateSerial();
mySerial.println("AT+CMGS="0497249119"");//xxxxxxxxxxx is the phone number
updateSerial();
mySerial.print("Dit is een test"); //text content
updateSerial();
mySerial.write(26);
while(1)
{
if(mySerial.available())
{
Serial.write(mySerial.read());}//Data received by mySerial will be outputted by Serial }
if(Serial.available())
{
mySerial.write(Serial.read());//Data received by Serial will be outputted by mySerial }
}
}
}