Leonardo GPS AT commands: Serial vs Serial1 adaptation?

Hi, you are right that to modify the Serial into Serial1 for Leonardo using the sample sketches. But for to AT mode, it is very similar to this board, SIM808 with Leonardo mainboard SKU:DFR0355, i.e. you have to use the code below (For GPS debug) for AT command debugging, also the switches should be set as: S1: Comm; S2: Arduino; S3 should set as the same as above tutorial. One more note is the external power should be added as Leonardo costs more power even in GPS feature test.
void setup() {
Serial.begin(9600); //initialize Serial(i.e. USB port)
Serial1.begin(9600); //initialize Serial1
//Init the driver pins for GSM function
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
//Output GSM Timing
digitalWrite(5, HIGH);
delay(1500);
digitalWrite(5, LOW);
digitalWrite(3, HIGH); //disable GSM TX、RX
digitalWrite(4, HIGH); //disable GPS TX、RX
while (!Serial) {
; // wait for serial port to connect.
// Needed for native USB port only
}
Serial.println("Input AT please...");
}
void loop() {
while (Serial1.available()) {
Serial.write(Serial1.read());
}
while (Serial.available()) {
Serial1.write(Serial.read());
}
delay(1);
}
}
