Hi,
I am trying to use a map widget in a dashboard but when I try to create a Thing variable there is no such type of variable but it appears in the list of variable type in the Arduino Cloud. Can you help me with this problem.
Hi,
I am trying to use a map widget in a dashboard but when I try to create a Thing variable there is no such type of variable but it appears in the list of variable type in the Arduino Cloud. Can you help me with this problem.
Is it the same issue as here: DHT11 and cloud variable
Hi @repc_up.
Do this:
You will now be able to link that variable to a "Map" widget when you add it to the dashboard.
If you still encounter a problem while following those instructions, or if this does not resolve your problem, then provide a detailed description of your situation in a reply here on this forum topic and we'll provide further assistance.
Is that not a problem? How is Location a sub set of Size & Motion? Shouldn't that menu structure be changed to make sense?
Hi,
I can declare the location variable and link with the map widget in a dashboard but when I run my program the map doesn’t show nothing, I am using an Arduino R4 Wifi. I enclosed the code:
/*
Sketch generated by the Arduino IoT Cloud Thing "casa_26"
https://create.arduino.cc/cloud/things/dc4deab8-bec8-4f8e-b41c-310c3356a0b1
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
String mensaje;
int angulo;
CloudLocation ubicacion;
CloudLuminousFlux lux;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
//Librerias necesarias para el funcionamiento del sensor BH1750
#include <Wire.h>
#include <ArtronShop_BH1750.h>
//Creacion de instancia para manejar el sensor
ArtronShop_BH1750 bh1750(0x23, &Wire); // Non Jump ADDR: 0x23, Jump ADDR: 0x5C
//Libreria para manejo del servomotor
#include <Servo.h>
// Se conecta el control del servo al pin 11
#define motor 11
//Declaracion de instancia
Servo persiana;
//Cadenas de mensajes
String p00 = "Persianas cerradas";
String p45 = "Persianas punto medio";
String p90 = "Persianas abiertas";
void setup()
{
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Inicializacion del sensor
Wire.begin();
while (!bh1750.begin())
{
Serial.println("BH1750 not found !");
delay(1000);
}
//Declaracion de pin 11 como salidaa
pinMode(motor,OUTPUT);
//Asociacion del pin de control con la instancia
persiana.attach(motor);
//Generacion de secuencia de prueba
persiana.write(0);
delay(500);
persiana.write(90);
delay(500);
persiana.write(180);
delay(500);
persiana.write(0);
delay(500);
angulo=0;
}
void loop()
{
ArduinoCloud.update();
//Serial.print("Intensidad luminosa: ");
//Serial.print(bh1750.light());
//Serial.print(" lx");
//Serial.println();
lux=bh1750.light();
Location coordenadas = ubicacion.getValue();
Serial.println(coordenadas.lat);
Serial.println(coordenadas.lon);
posicionamiento();
delay(500);
}
void posicionamiento()
{
// Movimiento de persiana para oscuridad
if((lux>=0)&&(lux<50))
{
persiana.write(0);
angulo=0;
mensaje=p00;
}
// Movimiento de persiana para luz natural
else if((lux>=50)&&(lux<4000))
{
persiana.write(45);
angulo=45;
mensaje=p45;
}
// Movimiento de persiana para luz del celular
else
{
persiana.write(90);
angulo=90;
mensaje=p90;
}
}
/*
Since Angulo is READ_WRITE variable, onAnguloChange() is
executed every time a new value is received from IoT Cloud.
*/
void onAnguloChange()
{
// Add your code here to act upon Angulo change
}
/*
Since Mensaje is READ_WRITE variable, onMensajeChange() is
executed every time a new value is received from IoT Cloud.
*/
void onMensajeChange()
{
// Add your code here to act upon Mensaje change
}
/*
Since Ubicacion is READ_WRITE variable, onUbicacionChange() is
executed every time a new value is received from IoT Cloud.
*/
void onUbicacionChange()
{
// Add your code here to act upon Ubicacion change
}
By "nothing", do you mean that the content of the Map Widget is solid blue?:
If so, this is normal and expected. You don't assign a value to the ubicacion Variable in the Thing sketch, so it has the default value. That default is 0 values for latitude and longitude (0°00'00.0"N 0°00'00.0"E). That coordinate is in the middle of the Gulf of Guinea, so at the default zoom you only see ocean in the Widget. If you click the - control several times to zoom out, you will see the location in the broader geographic context: