Add GPS module support: implement GPS_Init, GPS_Read, and GPS_Data functions
This commit is contained in:
5
hardware/include/GPS.hpp
Normal file
5
hardware/include/GPS.hpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#define RX 4
|
||||||
|
#define TX 5
|
||||||
|
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
|
void GPS_Init();
|
||||||
25
hardware/src/GPS.cpp
Normal file
25
hardware/src/GPS.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include "GPS.h"
|
||||||
|
char c = "";
|
||||||
|
|
||||||
|
|
||||||
|
void GPS_Init(){
|
||||||
|
SoftwareSerial gps(RX, TX); // RX, TX
|
||||||
|
|
||||||
|
Serial.begin(9600);
|
||||||
|
gps.begin(9600);
|
||||||
|
Serial.println("GPS Initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPS_Read(){
|
||||||
|
|
||||||
|
if (gps.available()) {
|
||||||
|
c = gps.read();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String GPS_Data(char data){
|
||||||
|
char[] c = data.split(",");
|
||||||
|
float lon = c[2];
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user