Deneyap Kart – GPS_GLONASS

#include <Deneyap_OLED.h>
OLED OLED1;

#include <Deneyap_GPSveGLONASSkonumBelirleyici.h>  // Deneyap GPS ve GLONASS Konum Belirleyici kutuphanesi eklenmesi
GPS GPS;

unsigned long timer1 = 0;

void setup() {
  //Serial.begin(115200);

  //OLED Ekran Modülü
  OLED1.begin(0x7A);
  OLED1.clearDisplay();

  if (!GPS.begin(0x2F)) {  // begin(slaveAdress) fonksiyonu ile cihazların haberleşmesi başlatılması
    delay(3000);
    OLED1.putString("GPS BASLAMADI!  ");  // I2C bağlantısı başarısız olursa seri monitore yazdırılması
    while (1);
  }
  delay(3000);
  OLED1.clearDisplay();
}

void loop() {
  Timer();
}

void Timer() {
  if (millis() - timer1 >= 1000 || millis() < timer1) {
    timer1 = millis();

    GPS.readGPS(RMC);  // NMEA protokolünün RMC mesaj türü ile verinin okunması

    int s = 0;
    OLED1.setTextXY(s, 0);
    OLED1.putString("  GPS GLONASS   ");

    OLED1.setTextXY(s + 2, 0);
    OLED1.putString("En: ");

    float lat;
    lat = GPS.readLocationLat();
    OLED1.putNumber(floor(lat));
    OLED1.putString(".");
    OLED1.putNumber(floor(lat * 10000 - floor(lat) * 10000));

    float lng;
    lng = GPS.readLocationLng();
    OLED1.setTextXY(s + 4, 0);
    OLED1.putString("By: ");
    OLED1.putNumber(floor(lng));
    OLED1.putString(".");
    OLED1.putNumber(floor(lng * 10000 - floor(lng) * 10000));

    int day;
    day = GPS.readDay();
    OLED1.setTextXY(s + 6, 0);
    if (day < 10) {
      OLED1.putString("0");
    }
    OLED1.putNumber(day);
    OLED1.putString("/");

    int month;
    month = GPS.readMonth();
    if (month < 10) {
      OLED1.putString("0");
    }
    OLED1.putNumber(month);
    OLED1.putString("/");

    int year;
    year = GPS.readYear();
    OLED1.putNumber(year);

    int hour;
    hour = GPS.readHour();
    OLED1.setTextXY(s + 7, 0);
    if (hour < 10) {
      OLED1.putString("0");
    }
    OLED1.putNumber(hour);
    OLED1.putString(":");

    int minute;
    minute = GPS.readMinute();
    if (minute < 10) {
      OLED1.putString("0");
    }
    OLED1.putNumber(minute);
    OLED1.putString(":");

    int second;
    second = GPS.readSecond();
    if (second < 10) {
      OLED1.putString("0");
    }
    OLED1.putNumber(second);
  }
}

Yorum bırakın