TinyGPS++ isn't being updated or SoftwareSerial isn't reading












0















I'm trying to read the GPS data on an Arduino Uno from a Neo-6M module and print it on a LCD display. However, no variable is being changed by the read function. This could either be because of an incorrect reading of the gps variable or a wrong use of the SoftwareSerial library.



Here's the code:



#include <TinyGPS++.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <splash.h>

#include <SoftwareSerial.h>

Adafruit_SSD1306 display; // Create display
SoftwareSerial gpsSerial(4,3);//rx,tx
float lati=0,longi=0;
float sat=0;
TinyGPSPlus gps; // create gps object



void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSerial.begin(9600); // connect gps sensor
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize display with the I2C address of 0x3C
display.clearDisplay();
display.setTextColor(WHITE);
}

void loop() {
// put your main code here, to run repeatedly:
display.clearDisplay();


gps.encode(gpsSerial.read());
display.setCursor(80,3);
display.print("R");


//if(gps.location.isUpdated())
{
lati = gps.location.lat();
longi = gps.location.lng();
sat = gps.satellites.value();
display.setCursor(100,3);
display.print("U");
}

display.setCursor(20,20);
display.print(lati);
display.setCursor(20,40);
display.print(longi);
display.setCursor(100,40);
display.print(sat);
display.drawRect(0,0,127,63,WHITE);
display.display();
}


EDIT: The data coming from gpsSerial is a series of -1
EDIT 2: Swapping SoftwareSerial gpsSerial(4,3); to SoftwareSerial gpsSerial(4,3); makes it output a series of ints. However, encoding it with gps.encode(gpsSerial.read()) still doesn't update the data.










share|improve this question













migrated from stackoverflow.com Nov 26 '18 at 17:22


This question came from our site for professional and enthusiast programmers.



















  • no prints to Serial? why not use it for debug prints or connect the gps to it?

    – Juraj
    Nov 20 '18 at 19:27











  • I'm powering the arduino with a battery to be able to go outside to test the reception, so I'm printing the information on the screen to read it as it's collected

    – Marco Giacomin
    Nov 20 '18 at 19:39











  • then connect the module to Serial and don't use SoftwareSerial

    – Juraj
    Nov 20 '18 at 19:39











  • I don't have a serial to miniUSB cable

    – Marco Giacomin
    Nov 20 '18 at 19:41











  • pins RX and TX. 0 and 1.

    – Juraj
    Nov 20 '18 at 19:45
















0















I'm trying to read the GPS data on an Arduino Uno from a Neo-6M module and print it on a LCD display. However, no variable is being changed by the read function. This could either be because of an incorrect reading of the gps variable or a wrong use of the SoftwareSerial library.



Here's the code:



#include <TinyGPS++.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <splash.h>

#include <SoftwareSerial.h>

Adafruit_SSD1306 display; // Create display
SoftwareSerial gpsSerial(4,3);//rx,tx
float lati=0,longi=0;
float sat=0;
TinyGPSPlus gps; // create gps object



void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSerial.begin(9600); // connect gps sensor
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize display with the I2C address of 0x3C
display.clearDisplay();
display.setTextColor(WHITE);
}

void loop() {
// put your main code here, to run repeatedly:
display.clearDisplay();


gps.encode(gpsSerial.read());
display.setCursor(80,3);
display.print("R");


//if(gps.location.isUpdated())
{
lati = gps.location.lat();
longi = gps.location.lng();
sat = gps.satellites.value();
display.setCursor(100,3);
display.print("U");
}

display.setCursor(20,20);
display.print(lati);
display.setCursor(20,40);
display.print(longi);
display.setCursor(100,40);
display.print(sat);
display.drawRect(0,0,127,63,WHITE);
display.display();
}


EDIT: The data coming from gpsSerial is a series of -1
EDIT 2: Swapping SoftwareSerial gpsSerial(4,3); to SoftwareSerial gpsSerial(4,3); makes it output a series of ints. However, encoding it with gps.encode(gpsSerial.read()) still doesn't update the data.










share|improve this question













migrated from stackoverflow.com Nov 26 '18 at 17:22


This question came from our site for professional and enthusiast programmers.



















  • no prints to Serial? why not use it for debug prints or connect the gps to it?

    – Juraj
    Nov 20 '18 at 19:27











  • I'm powering the arduino with a battery to be able to go outside to test the reception, so I'm printing the information on the screen to read it as it's collected

    – Marco Giacomin
    Nov 20 '18 at 19:39











  • then connect the module to Serial and don't use SoftwareSerial

    – Juraj
    Nov 20 '18 at 19:39











  • I don't have a serial to miniUSB cable

    – Marco Giacomin
    Nov 20 '18 at 19:41











  • pins RX and TX. 0 and 1.

    – Juraj
    Nov 20 '18 at 19:45














0












0








0








I'm trying to read the GPS data on an Arduino Uno from a Neo-6M module and print it on a LCD display. However, no variable is being changed by the read function. This could either be because of an incorrect reading of the gps variable or a wrong use of the SoftwareSerial library.



Here's the code:



#include <TinyGPS++.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <splash.h>

#include <SoftwareSerial.h>

Adafruit_SSD1306 display; // Create display
SoftwareSerial gpsSerial(4,3);//rx,tx
float lati=0,longi=0;
float sat=0;
TinyGPSPlus gps; // create gps object



void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSerial.begin(9600); // connect gps sensor
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize display with the I2C address of 0x3C
display.clearDisplay();
display.setTextColor(WHITE);
}

void loop() {
// put your main code here, to run repeatedly:
display.clearDisplay();


gps.encode(gpsSerial.read());
display.setCursor(80,3);
display.print("R");


//if(gps.location.isUpdated())
{
lati = gps.location.lat();
longi = gps.location.lng();
sat = gps.satellites.value();
display.setCursor(100,3);
display.print("U");
}

display.setCursor(20,20);
display.print(lati);
display.setCursor(20,40);
display.print(longi);
display.setCursor(100,40);
display.print(sat);
display.drawRect(0,0,127,63,WHITE);
display.display();
}


EDIT: The data coming from gpsSerial is a series of -1
EDIT 2: Swapping SoftwareSerial gpsSerial(4,3); to SoftwareSerial gpsSerial(4,3); makes it output a series of ints. However, encoding it with gps.encode(gpsSerial.read()) still doesn't update the data.










share|improve this question














I'm trying to read the GPS data on an Arduino Uno from a Neo-6M module and print it on a LCD display. However, no variable is being changed by the read function. This could either be because of an incorrect reading of the gps variable or a wrong use of the SoftwareSerial library.



Here's the code:



#include <TinyGPS++.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <splash.h>

#include <SoftwareSerial.h>

Adafruit_SSD1306 display; // Create display
SoftwareSerial gpsSerial(4,3);//rx,tx
float lati=0,longi=0;
float sat=0;
TinyGPSPlus gps; // create gps object



void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSerial.begin(9600); // connect gps sensor
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize display with the I2C address of 0x3C
display.clearDisplay();
display.setTextColor(WHITE);
}

void loop() {
// put your main code here, to run repeatedly:
display.clearDisplay();


gps.encode(gpsSerial.read());
display.setCursor(80,3);
display.print("R");


//if(gps.location.isUpdated())
{
lati = gps.location.lat();
longi = gps.location.lng();
sat = gps.satellites.value();
display.setCursor(100,3);
display.print("U");
}

display.setCursor(20,20);
display.print(lati);
display.setCursor(20,40);
display.print(longi);
display.setCursor(100,40);
display.print(sat);
display.drawRect(0,0,127,63,WHITE);
display.display();
}


EDIT: The data coming from gpsSerial is a series of -1
EDIT 2: Swapping SoftwareSerial gpsSerial(4,3); to SoftwareSerial gpsSerial(4,3); makes it output a series of ints. However, encoding it with gps.encode(gpsSerial.read()) still doesn't update the data.







gps arduino-uno arduino-ide






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 19:18









Marco GiacominMarco Giacomin

13




13




migrated from stackoverflow.com Nov 26 '18 at 17:22


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Nov 26 '18 at 17:22


This question came from our site for professional and enthusiast programmers.















  • no prints to Serial? why not use it for debug prints or connect the gps to it?

    – Juraj
    Nov 20 '18 at 19:27











  • I'm powering the arduino with a battery to be able to go outside to test the reception, so I'm printing the information on the screen to read it as it's collected

    – Marco Giacomin
    Nov 20 '18 at 19:39











  • then connect the module to Serial and don't use SoftwareSerial

    – Juraj
    Nov 20 '18 at 19:39











  • I don't have a serial to miniUSB cable

    – Marco Giacomin
    Nov 20 '18 at 19:41











  • pins RX and TX. 0 and 1.

    – Juraj
    Nov 20 '18 at 19:45



















  • no prints to Serial? why not use it for debug prints or connect the gps to it?

    – Juraj
    Nov 20 '18 at 19:27











  • I'm powering the arduino with a battery to be able to go outside to test the reception, so I'm printing the information on the screen to read it as it's collected

    – Marco Giacomin
    Nov 20 '18 at 19:39











  • then connect the module to Serial and don't use SoftwareSerial

    – Juraj
    Nov 20 '18 at 19:39











  • I don't have a serial to miniUSB cable

    – Marco Giacomin
    Nov 20 '18 at 19:41











  • pins RX and TX. 0 and 1.

    – Juraj
    Nov 20 '18 at 19:45

















no prints to Serial? why not use it for debug prints or connect the gps to it?

– Juraj
Nov 20 '18 at 19:27





no prints to Serial? why not use it for debug prints or connect the gps to it?

– Juraj
Nov 20 '18 at 19:27













I'm powering the arduino with a battery to be able to go outside to test the reception, so I'm printing the information on the screen to read it as it's collected

– Marco Giacomin
Nov 20 '18 at 19:39





I'm powering the arduino with a battery to be able to go outside to test the reception, so I'm printing the information on the screen to read it as it's collected

– Marco Giacomin
Nov 20 '18 at 19:39













then connect the module to Serial and don't use SoftwareSerial

– Juraj
Nov 20 '18 at 19:39





then connect the module to Serial and don't use SoftwareSerial

– Juraj
Nov 20 '18 at 19:39













I don't have a serial to miniUSB cable

– Marco Giacomin
Nov 20 '18 at 19:41





I don't have a serial to miniUSB cable

– Marco Giacomin
Nov 20 '18 at 19:41













pins RX and TX. 0 and 1.

– Juraj
Nov 20 '18 at 19:45





pins RX and TX. 0 and 1.

– Juraj
Nov 20 '18 at 19:45










0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "540"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58218%2ftinygps-isnt-being-updated-or-softwareserial-isnt-reading%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Arduino Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58218%2ftinygps-isnt-being-updated-or-softwareserial-isnt-reading%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini