Can someone help me plz…
Now i setting the ESP32 Dev kit board+ NEO-7M GPS module+ADS1115 module. and i upload my GPS location data to blynk cloud and add the map widget at my dashboard, template too. under my code, but any gps signal read at map widget. Can someone check these problem with my code?
• Blynk Library version
• Add your sketch code.
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
#include <TinyGPS++.h>
// Replace with your network credentials
char ssid[] = "aaaa";
char pass[] = "password";
// Replace with your Blynk auth token
char auth[] = "xxxxxxx";
// Create an instance of the ADS1115
Adafruit_ADS1115 ads;
// Create an instance of the TinyGPS++ object
TinyGPSPlus gps;
// Set the analog input pin for the ADS1115
const int analogInPin = 0;
void setup()
{
// Start the serial communication with a baud rate of 9600
Serial.begin(9600);
// Start the I2C communication with a clock speed of 400kHz
Wire.begin(21, 22, 400000);
// Initialize the ADS1115 with the default I2C address (0x48)
ads.begin();
// Connect to Wi-Fi network
WiFi.begin(ssid, pass);
// Wait for connection
while (WiFi.status() != WL_CONNECTED)
{
delay(1000);
Serial.println("Connecting to WiFi...");
}
// Print the Wi-Fi connection information
Serial.println("Connected to WiFi");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// Connect to Blynk server
Blynk.begin(auth, WiFi.SSID().c_str(), WiFi.psk().c_str());
// Wait for Blynk connection
while (!Blynk.connected())
{
delay(0);
Serial.println("Connecting to Blynk...");
}
// Start the GPS module with a baud rate of 9600
Serial1.begin(9600);
}
void loop()
{
// Check if there is data available from the GPS module
while (Serial1.available() > 0)
{
// Read the data from the GPS module
gps.encode(Serial2.read());
}
// Check if there is a fix from the GPS module
if (gps.location.isValid())
{
// Read the voltage from the ADS1115
int16_t adc0 = ads.readADC_SingleEnded(0);
// Convert the ADC value to a voltage in millivolts
float voltage = ((float)adc0 / 32767.0) * 5.0 * 2.0 - 5.0;
// Print the voltage and GPS data
Serial.print("Voltage: ");
Serial.println(voltage);
Serial.print("Latitude: ");
Serial.println(gps.location.lat(), 6);
Serial.print("Longitude: ");
Serial.println(gps.location.lng(), 6);
// Send the GPS data to Blynk
Blynk.virtualWrite(V2, gps.location.lat(), gps.location.lng(),"GPS Location");
// Send the GPS data to Blynk
Blynk.virtualWrite(V4, gps.location.lat(), "GPS lat");
// Send the GPS data to Blynk
Blynk.virtualWrite(V5, gps.location.lat(), "GPS lng");
}
// Run Blynk event loop
Blynk.run();
}