Hi, I need help using the Map widget to accomplish a couple of things:
- using Blynk.setProperty(V1, “color”, “#23C48E”); // GREEN to set the color of the marker showing the GPS position on the Map widget
- displaying more than a few characters in the small popup window that appears when the marker is touched
• HW: ESP8266 with WiFi
• iOS 13.3.1 App is 2.26.2
• Blynk server
• Blynk Library version 0.61
When I run the 3 examples (below) I get results as follows:
Example 1: A standard black marker is displayed at the correct GPS position. The setProperty call seems to have no effect on the color of the text or marker icon. Expected (hoped) to see a GREEN marker.
Example 2: When marker is touched the displayed text is truncated with the first item. I was expecting the complete string to be displayed, and hoping the newline ("\n") would force a second line of text. I’d like to display several short lines of data in the popup.
Example 3: no GPS marker is displayed. Not sure why this is.
Here is my example code, simplified to show the function I am working on:
//Output any data on Map widget!
//
// App project setup:
// Map widget on V1
// *************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxxxx";
WidgetMap myMap(V1);
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
// If you want to remove all points:
myMap.clear();
int airQualityIndex = 40;
// Example 1
char pmLabel [20];
sprintf(pmLabel, "AQI:%3d\n", airQualityIndex);
int index = 0;
float lat = 37.9210;
float lon = -122.5544;
Blynk.setProperty(V1, "color", "#23C48E"); // GREEN
myMap.location(index, lat, lon, pmLabel); // display GPS position with PM AQI label
// Example 2
String pmLabel1;
pmLabel1 += "Term 1";
pmLabel1 += "\n";
pmLabel1 += "Term 2";
index = 1;
lat = 37.9215;
lon = -122.5549;
myMap.location(index, lat, lon, pmLabel1); // display GPS position with PM AQI label
// Example 3
pmLabel1 = " ";
pmLabel1 += "Term 1";
pmLabel1 += ",";
pmLabel1 += "Term 2";
index = 102;
lat = 37.9218;
lon = -122.5553;
myMap.location(index, lat, lon, pmLabel1); // display GPS position with PM AQI label
}
void loop()
{
Blynk.run();
}
Any help appreciated!