ESP32+iPhone can't read Datastream's GPS(latitude, longitude) and print serial monitor

• ESP32-WROOM-DA Module + USB2.0
• Smartphone OS (iPhone SE gen3) + version 16.3.1
• Blynk Library version 1.2.0

  • I have been making smart car that can follow me by guiding from my iPhone’s GPS.
  • However I’m struggling in sending GPS parameter of iPhone to ESP32 board and can’t print anythings to serial monitor.(It can be print normally if i put Serial.print into void setup;)
  • LED on ESP32 on/off properly works.
  • I tried blynk’s mapwidget example in arduino IDE but failed to comply with wifi code.
  • If i use “GpsParam gps(param);” in Blynk_Write Both will say not
    declared in these scope.


/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  ESP32, Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build mobile and web interfaces for any
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: https://www.blynk.io
    Sketch generator:           https://examples.blynk.cc
    Blynk community:            https://community.blynk.cc
    Follow us:                  https://www.fb.com/blynkapp
                                https://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on ESP32 chip.

  NOTE: This requires ESP32 support package:
    https://github.com/espressif/arduino-esp32

  Please be sure to select the right ESP32 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "********"
#define BLYNK_TEMPLATE_NAME "*******"
#define BLYNK_AUTH_TOKEN "********"


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <TinyGPS++.h>
#include <HardwareSerial.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "******";
char pass[] = "******";
int LED_test = 2 ;

//BlynkTimer timer;

void setup()
{
  // Debug console
  Serial.begin(115200);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
  pinMode(LED_test, OUTPUT);
}

void loop()
{
  Blynk.run();
  //timer.run();
}

BLYNK_WRITE(V6) {
  double latitude = param[0].asDouble(); 
  double longitude = param[1].asDouble();
  float altitude = param[2].asFloat();
  float speed = param[3].asFloat();
  
  Blynk.virtualWrite(V6, longitude, latitude);

  // Print 7 decimal places for Lat
  Serial.println(latitude, 7); 
  Serial.println(longitude, 7);
}

BLYNK_WRITE(2) { //turn right
  digitalWrite(LED_test, param.asInt());
}

I don’t believe it’s possible to obtain the location of the phone running the Blynk app.
As it’s possible to be signed-in to the same account on multiple mobile devices (phones, tablets etc) and the web dashboard, I don’t see how it would be possible for Blynk to know which device it’s meant to be mapping.

The device tracking is intended to be used to track hardware devices (the ESP32 in this case) not the phone.

In addition, your sketch is rather weird, attempting to read data from V6 then writing it straight back again, so this wouldn’t work anyway.

Pete.

GPS Stream parameter with python-library - Need Help With My Project - Blynk Community
blynkkk.github.io/gps_streaming.md at master · blynkkk/blynkkk.github.io
Trying to test GPS - Solved - Blynk Community
IoT Based Android phone accelerometer controlled robot - Blynk Projects (hackster.io)

I tired these methods but they didn’t work.
I can’t find the widget that uses the mobile sensor in the Blynk App’s widget box.
Or all that said is not available ?
Map in web dashboard is for track gps with timestamp that’s not my intention.



On-OFF V3 only print V3’s values

/* Comment this out to disable prints and save space */

#define BLYNK_PRINT Serial

/* Fill in information from Blynk Device Info here */

#define BLYNK_TEMPLATE_ID "*****"

#define BLYNK_TEMPLATE_NAME "*****"

#define BLYNK_DEVICE_NAME "*******"

#define BLYNK_AUTH_TOKEN "*************"

#include <BlynkSimpleEsp32.h>

#include <WiFi.h>

#include <WiFiClient.h>

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "CLASS@BURIRAM";

char pass[] = "044163910";

int LED_test = 2 ;

BlynkTimer timer;

void setup()

{

  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);

  //timer.setInterval(1000L, getGpsLocation); // call getGpsLocation every 1 second

  pinMode(LED_test, OUTPUT);

}

void loop()

{

  Blynk.run();

  timer.run();

}
//-------V3 is button
//-------V6 is location
BLYNK_WRITE(V3) {

  //double lat ;

  //double lon ;

    WidgetMap myMap(V6);{

    int index = 1;

    double lat = param[0].asDouble();

    double lon = param[1].asDouble();

    float alt = param[2].asFloat();

    float speed = param[3].asFloat();    

    myMap.location(index, lat, lon, "value");

    Serial.println(lat, 7);

    Serial.println(lon, 7);

    }

}

BLYNK_WRITE(2) { //turn light

  digitalWrite(LED_test, param.asInt());

}

BLYNK_WRITE(V6) {

  float latitude = param[0].asFloat();

  float longitude = param[1].asFloat();

  float altitude = param[2].asFloat();

  float speed = param[3].asFloat();

  Serial.println(latitude, 7);

  Serial.println(longitude, 7);

  Serial.println(altitude, 7);

  Serial.println(speed, 7);

}

These examples are all for Blynk Legacy. Blynk IoT doesn’t have GPS streaming or location widgets anymore.

Pete.