Skip to content

Instantly share code, notes, and snippets.

@volodink
Created October 5, 2018 12:57
Show Gist options
  • Select an option

  • Save volodink/bc8caf9028f96227f9d1a6ddee2a42b4 to your computer and use it in GitHub Desktop.

Select an option

Save volodink/bc8caf9028f96227f9d1a6ddee2a42b4 to your computer and use it in GitHub Desktop.
gsmtest2
#include <SoftwareSerial.h>
SoftwareSerial gsm(10, 11); // RX, TX
SoftwareSerial gps(2, 3); // RX, TX
char response[100];
void setup() {
pinMode(5, OUTPUT);
digitalWrite(5, LOW);
delay(1000);
digitalWrite(5, HIGH);
delay(3000);
digitalWrite(5, LOW);
Serial.begin(9600);
Serial.println("AI begin.");
Serial.flush();
gsm.begin(9600);
gsm.flush();
delay(1000);
do {
gsm.println("AT");
Serial.print(".");
delay(500);
} while (!gsm.find("OK"));
delay(5000);
gsm.println("AT+GPS=1");
delay(100);
if (gsm.available())
while (gsm.available())
{
Serial.print((char)gsm.read());
}
delay(1000);
gps.begin(9600);
gps.flush();
delay(1000);
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
if (gps.available())
while (gps.available())
{
Serial.print((char)gps.read());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment