Hi!
So i'm using Ai-Thinker A7 and Arduino UNO for my project to get GPS coordinates and then send it via SMS. I tested both of the codes separately, they worked fine, the coordinates appear on the serial monitor and i got the SMS.
connection for GPS:
UNO -> A7 (external power)
D11(RX) -> TX
D10(TX) -> RX
GND -> GND
connection for SMS:
UNO -> A7 (external power)
RX -> TX
TX -> RX
GND -> GND
here is the GPS code
#include <SoftwareSerial.h>
byte RX = 10;
byte TX = 11;
SoftwareSerial *A7board = new SoftwareSerial(RX, TX);
void print_result()
{
Serial.print("A7 board info: ");
while( A7board->available() != 0)
Serial.write( A7board->read());
Serial.println();
}
void setup() {
Serial.begin(115200);
A7board->begin(115200);
delay(200);
Serial.println("Send AT command");
A7board->println("AT");
delay(25000);
print_result();
Serial.println("AT+GPS turn on");
A7board->println("AT+GPS=1");
delay(10000);
print_result();
Serial.println("AT+GPSRD turn on");
A7board->println("AT+GPSRD=1");
delay(10000);
print_result();
}
void loop() {
print_result();
delay(2000);
}
here is the SMS code:
char phone_no[]="08xxxxxxxxx";
void setup() {
Serial.begin(9600);
delay(300);
Serial.println("AT+CMGF=1");
delay(2000);
Serial.print("AT+CMGS=\"");
Serial.print(phone_no);
Serial.write(0x22);
Serial.write(0x0D);
Serial.write(0x0A);
delay(2000);
Serial.print("A7 sent message yo");
delay(500);
i noticed that these codes using a different RX & TX pins but the A7 has only 1 pin for each TX and RX, so I'm confused, how am i going to combine these codes.
I'm hoping it could either using pin 10,11 or the RX TX on the Arduino.
if it can't, please provide me with solutions.
Any kind of help would be appreciated