• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
pozycja z gps na 1,8 tft lcd - dziwne znaki
#3
Masz rację korzystam z gotowców i modyfikuję je częściowo metodą prób i błędów do własnych potrzeb.
Niestety nauka C++ wymaga czasu a tego nie mam wystarczającoSad nauczyciela tez nie,
Przerobiłem trochę wygooglanych "kursów" część projektu przy ich pomocy zrobiłem ale to mi nie pozwoliło zrealizować całości, dlatego szukam pomocy na forum.

Wiem że ten kod jest eeee "nie do końca idealny"  Rolleyes ale wyświetla pozycję, jednak tylko raz, żeby ja zaktualizować trzeba resetować arduinoSad jeszcze "tylko" odświeżanie live i będę zadowolony.
Kod:
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <TFT.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
#define cs   10
#define dc   9
#define rst  8
TFT TFTscreen = TFT(cs, dc, rst);

char latitude_c[15];
char latitude[15];
char longitude_c[15];
char longitude[15];
char lat_c[4];
char lat[4];
char lon_c[4];
char lon[4];
 
void setup() {
  TFTscreen.begin();
  ss.begin(GPSBaud);
  TFTscreen.background(0, 0, 0);
  TFTscreen.stroke(0, 255, 100);
  TFTscreen.setTextSize(2);
  TFTscreen.text("DANE GPS", 2, 2);
}
void loop()
{
{
 String latitude_b =String(gps.location.lat(),8);
 latitude_b.toCharArray(latitude_c,15);          // convert the reading to a char array
 String lat_b = String(gps.location.lat(),6);
 lat_b.toCharArray(lat_c, 10);                   // convert the reading to a char array
 latitude_b.toCharArray(latitude,25);            // convert the reading to a char array
 lat_b.toCharArray(lat, 10);                     // convert the reading to a char array
 
 while (ss.available() > 0)
 if (gps.encode(ss.read()))
 if (millis() > 5000 && gps.charsProcessed() < 10)
 {
 TFTscreen.stroke(255, 255, 0);
 TFTscreen.setTextSize(2);
 TFTscreen.text("BRAK POL Z GPS",2, 80);
 while(true);
 }
 TFTscreen.stroke(255, 255, 0);
 TFTscreen.setTextSize(2);
 if (gps.location.isValid())
 {
 TFTscreen.stroke(0, 0, 0);
 TFTscreen.text("BRAK SYGN. GPS",2, 75);
 TFTscreen.stroke(0, 255, 50);
 TFTscreen.text("GPS OK",2, 50);
 TFTscreen.text(lat,2, 90);

 delay(1500);
 
 TFTscreen.noStroke();
 TFTscreen.fill(0, 0, 0);
 TFTscreen.rect(0, 65, 160, 50);
 delay(5);
 }
 else
 {
 TFTscreen.text("BRAK SYGN",2, 75);
 }}}


Rozumiem że nauka C++ byłaby najlepsza, ale chodzi tu o wyłącznie jeden projekt, to trochę tak ja uczyć się języka żeby przeczytać jedną broszurę w oryginale.
 
Odpowiedź
  


Wiadomości w tym wątku
RE: pozycja z gps na 1,8 tft lcd - dziwne znaki - przez jack1987 - 21-11-2017, 18:34

Skocz do:


Przeglądający: 2 gości