TinyGPS++ isn't being updated or SoftwareSerial isn't reading
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
migrated from stackoverflow.com Nov 26 '18 at 17:22
This question came from our site for professional and enthusiast programmers.
|
show 3 more comments
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
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
|
show 3 more comments
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
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
gps arduino-uno arduino-ide
asked Nov 20 '18 at 19:18
Marco Giacomin
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
|
show 3 more comments
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
|
show 3 more comments
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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