SHARE
TWEET

Untitled

a guest May 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <TinyGPS++.h>
  2. #include <SoftwareSerial.h>
  3.  
  4. static const int RXPin = 4, TXPin = 3;
  5. static const int RXD = 9, TXD = 10;
  6. static const int TPL = 12;
  7. static const uint32_t GPSBaud = 9600;
  8.  
  9. // The TinyGPS++ object
  10. TinyGPSPlus gps;
  11.  
  12. // The serial connection to the GPS device
  13. SoftwareSerial serialGps(RXPin, TXPin);
  14. SoftwareSerial BLE(RXD, TXD);
  15.  
  16. void setup(){
  17.   Serial.begin(9600);
  18.   serialGps.begin(GPSBaud);
  19.   BLE.begin(GPSBaud);
  20.   digitalWrite(TPL, LOW);
  21. }
  22.  
  23. void loop(){
  24.   // This sketch displays information every time a new sentence is correctly encoded.
  25.   while (serialGps.available() > 0){
  26.     gps.encode(serialGps.read());
  27.     if (gps.location.isUpdated()){
  28.       char[]lokacija = '';
  29.       BLE.write(gps.location.lat());
  30.       BLE.write(gps.location.lng());
  31.       digitalWrite(TPL, HIGH);
  32.      
  33.     }
  34.   }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top