-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Location: INVALID #127
Comments
I see you define the baud for GPS, but that is never used again. static const uint32_t GPSBaud = 9600; That's fine, because you later initialize two serial ports at 9600 baud. It looks like Serial is your debugging port, based on usage in your code. void display() This will not work.
or
The first code is a little faster because it doesn't repeatedly call Serial2.available(); |
I was wondering why "GPSbytesAvailable--" is faster? |
Nope, NOT calling serial.available() is faster as you need to query something that's for sure a call to some hardware. |
Hello, I am using gps nut it shows error. i am sharing the code please, let me know the solution.
#define TINY_GSM_MODEM_SIM7600 // SIM7600 AT instruction is compatible with A7670
#define SerialAT Serial1
#define SerialMon Serial
#define TINY_GSM_USE_GPRS true
#include <TinyGsmClient.h>
//#include <WiFi.h>
#include <Firebase_ESP_Client.h>
#include <Wire.h>
#include <L3G.h>
#include <TinyGPSPlus.h>
#define TINY_GSM_DEBUG SerialMon
#define TINY_GSM_USE_WIFI false
#include <addons/TokenHelper.h>
#include <addons/RTDBHelper.h>
TinyGPSPlus gps;
// See all AT commands, if wanted
#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger);
#else
TinyGsm modem(SerialAT);
#endif
TinyGsmClient client(modem);
// Define the serial console for debug prints, if needed
// set GSM PIN, if any
#define GSM_PIN ""
// Your GPRS credentials, if any
const char apn[] = "";
const char gprsUser[] = "";
const char gprsPass[] = "";
#define uS_TO_S_FACTOR 1000000ULL // Conversion factor for micro seconds to seconds
#define TIME_TO_SLEEP 600 // Time ESP32 will go to sleep (in seconds)
#define UART_BAUD 115200
//#define PIN_TX 26
//#define PIN_RX 27
static const int RXPin = 16, TXPin = 17;
static const uint32_t GPSBaud = 9600;
int sensor = 34;
int GX;
int GY;
int GZ;
L3G gyro;
TinyGsmClient gsm_client(modem);
float MQ3;
int Unique_ID;
double Latitude;
double Longitude;
#define API_KEY "......."
#define DATABASE_URL "......"
#define USER_EMAIL "......."
#define USER_PASSWORD "......."
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
unsigned long sendDataPrevMillis = 0;
unsigned long count = 0;
bool signupOK = false;
void setup()
{
Serial.begin(9600);
Serial2.begin(9600);
delay(3000);
{
Serial.println("Failed to autodetect gyro type!");
while (1);
}
gyro.enableDefault();
}
void loop()
{
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
}
display();
if (Firebase.ready() && (millis() - sendDataPrevMillis > 15000 || sendDataPrevMillis == 0))
{
sendDataPrevMillis = millis();
}
else{
Serial.println("outside the loop");
}
display();
}
void display(){
gps.encode(Serial2.read());
Serial.println("G ");
GX = (gyro.g.x);
Serial.println(GX);
GY = (gyro.g.y);
Serial.println(GY);
GZ = (gyro.g.z);
Serial.println(GZ);
}
Please let me know the error.
The text was updated successfully, but these errors were encountered: