Created
March 7, 2025 07:08
-
-
Save fxprime/787a7da6fc67b9959e601b2270b5d8c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <SoftwareSerial.h> | |
/* | |
lib_deps = | |
plerup/EspSoftwareSerial @ ^8.2.0 | |
tinyu-zhao/TinyGPSPlus-ESP32 @ ^0.0.2 | |
*/ | |
EspSoftwareSerial::UART gpsSerial; | |
void setup() { | |
Serial.begin(115200); | |
gpsSerial.begin(9600, EspSoftwareSerial::SWSERIAL_8N1, 5, 18, false, 95, 11); | |
} | |
void loop() { | |
if (gpsSerial.available()) { | |
Serial.write(gpsSerial.read()); | |
} | |
if (Serial.available()) { | |
gpsSerial.write(Serial.read()); | |
} | |
} | |
// ค่าที่ออกมา โดยประมาณ หลังมีไฟกระพริบตรงโมดูล GPS โดยปกติ เปิดใช้งานกับบ้านชั้นเดียวรอไม่เกิน10นาทีในครั้งแรก หลังจากเปิดมาแล้วหลายครั้งจะเร็วขึ้น และมีข้อมูลที่ออกมาดังนี้ | |
/* | |
$GPGGA,121908.00,0751.35084,N,09821.50910,E,1,08,1.16,39.3,M,-28.0,M,,*49 | |
$GPGSA,A,3,05,29,13,20,11,12,25,15,,,,,2.75,1.16,2.50*0D | |
$GPGSV,3,1,12,05,53,331,27,06,12,067,26,11,26,039,28,12,48,240,35*74 | |
$GPGSV,3,2,12,13,53,132,25,15,44,195,33,17,00,137,,19,22,127,21*7D | |
$GPGSV,3,3,12,20,31,014,32,23,06,235,19,25,28,281,33,29,11,328,19*79 | |
$GPGLL,0751.35084,N,09821.50910,E,121908.00,A,A*6C | |
$GPRMC,121909.00,A,0751.35081,N,09821.50910,E,0.039,,060325,,,A*79 | |
$GPVTG,,T,,M,0.039,N,0.072,K,A*2C | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment