fndacil
February 3, 2018, 5:49am
#1
hello neo 6m gps shield den i do not reflect the 2.4 tft screen to the screen i have a look at the codes where i am doing wrong no errors in compilation
#include “Adafruit_GFX.h”
#include “SWTFT.h”
#include <SPI.h>
#include <MCUFRIEND_kbv.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
//#include <Wire.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
MCUFRIEND_kbv tft;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
void setup(void) {
Serial.begin(115200);
Serial.println(“TFT LCD Shield Test”);
tft.reset();
uint16_t identifier = tft.readID();
Serial.print("Your LCD driver chip name is: ");
Serial.println(identifier, HEX);
tft.begin(identifier);
Serial.println(“Working Well”);
}
void loop()
{
for (uint8_t rotation = 0; rotation < 1; rotation++)
{
tft.setRotation(rotation);
Text();
delay(5000);
}
while (ss.available() > 0)
if (gps.encode(ss.read()))
if (gps.altitude.isUpdated())
if (gps.satellites.isUpdated())
Text();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
tft.setCursor(0,1);
tft.print(F(“GPS BAGLANTISI YOK”));
while (true);
}
}
void Text()
{
tft.fillScreen(0x0000);
tft.setCursor(0, 20);
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("SATALITE: " + String(gps.satellites.value()));
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("HDOP: " + String(gps.hdop.value()));
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("ALTITUDE: " + String(gps.altitude.meters()));
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("SPEED: " + String(gps.speed.kmph()));
delay(5000);
}
ieee488
February 3, 2018, 7:04pm
#2
fndacil:
hello neo 6m gps shield den i do not reflect the 2.4 tft screen to the screen i have a look at the codes where i am doing wrong no errors in compilation
I don't know what this means.
The first job is to format your code. Just press ctrl-T in the IDE.
#include "Adafruit_GFX.h"
#include "SWTFT.h"
#include <SPI.h>
#include <MCUFRIEND_kbv.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
//#include <Wire.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
MCUFRIEND_kbv tft;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
void setup(void) {
Serial.begin(115200);
Serial.println("TFT LCD Shield Test");
tft.reset();
uint16_t identifier = tft.readID();
Serial.print("Your LCD driver chip name is: ");
Serial.println(identifier, HEX);
tft.begin(identifier);
Serial.println("Working Well");
}
void loop()
{
for (uint8_t rotation = 0; rotation < 1; rotation++)
{
tft.setRotation(rotation);
Text();
delay(5000);
}
while (ss.available() > 0)
if (gps.encode(ss.read()))
if (gps.altitude.isUpdated())
if (gps.satellites.isUpdated())
Text();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
tft.setCursor(0, 1);
tft.print(F("GPS BAGLANTISI YOK"));
while (true);
}
}
void Text()
{
tft.fillScreen(0x0000);
tft.setCursor(0, 20);
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("SATALITE: " + String(gps.satellites.value()));
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("HDOP: " + String(gps.hdop.value()));
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("ALTITUDE: " + String(gps.altitude.meters()));
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("SPEED: " + String(gps.speed.kmph()));
delay(5000);
}
Now it is readable. You can spot some of the problems:
#include "SWTFT.h" //remove this. you are using MCUFRIEND_kbv
...
static const int RXPin = 4, TXPin = 3; //the TFT uses these pins
...
SoftwareSerial ss(RXPin, TXPin);
...
If you are not using the microSD digital #10 , 11, 12, 13 are spare.
Does SoftwareSerial allow you to put RXPin on different pins?
David.
fndacil
February 10, 2018, 5:13am
#4
no problem, but the screen refreshes at 5 seconds I want to see the variables without refreshing the screen
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 0, TXPin = 1;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
#include “Adafruit_GFX.h”
#include “SWTFT.h”
#include <SPI.h>
#include <MCUFRIEND_kbv.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
MCUFRIEND_kbv tft;
void setup() {
ss.begin(GPSBaud);
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(identifier);
for (uint8_t rotation = 0; rotation < 4; rotation++)
tft.setRotation(rotation);
tft.fillScreen(0x0000);
tft.setCursor(0, 0);
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println(“GPS BILGILERI”);
tft.setCursor(0, 20);
tft.setTextColor(0xFFE0);
tft.setTextSize(2);
tft.println("FATIH CIL ");
delay(8000);
}
void loop() {
while (ss.available() > 0)
if (gps.encode(ss.read()))
if (gps.altitude.isUpdated())
if (gps.satellites.isUpdated())
displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
for (uint8_t rotation = 0; rotation < 4; rotation++)
tft.setRotation(rotation);
tft.setCursor(0, 1);
tft.print(F(“No GPS detected: check wiring.”));
while (true);
}
}
void displayInfo(){
tft.fillScreen(0x0000);
tft.setCursor(0, 1);
tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(3);
tft.println("Sat: " + String(gps.satellites.value()));
// tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(3);
tft.println("Hdop: " + String(gps.hdop.value()));
// tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(3);
tft.println("Alt: " + String(gps.altitude.meters()));
// tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(3);
tft.println(“Speed:” + String(gps.speed.kmph()));
// tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(3);
tft.println("Lat: " + String(gps.location.lat(), 6));
// tft.println();
tft.setTextColor(0xFFE0);
tft.setTextSize(3);
tft.println("Long: " + String(gps.location.lng(), 6));
delay(5000);
}