I am working with a class using the IoT Rev 2 kits. Unfortunately, due to my school's network restrictions, students are using my phone's hotspot to connect their MKR-Wifi 1010 devices. However they are using the school network to connect to the cloud with their laptops.
This all works perfectly well except that the variables being displayed on the dashboard do not update unless they refresh the page. They also cannot use switches on their dashboard to interact with the device.
I presume that the reason for this is because the laptop and device are on different networks. When I connect the laptop to my hotspot as well, everything works as expected.
If this is the cause of the issue, I am not clear on why since both the laptop and Arduino device are accessing variables in the Cloud. Is it possible that there may be another browser or network setting that is causing this issue?
Any assistance you can provide would be much appreciated. Below is some code I am using to test:
/*
Sketch generated by the Arduino IoT Cloud Thing "TK Counter"
https://create.arduino.cc/cloud/things/afdab4ab-8b32-4669-be3f-c812bcdf8a54
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int count;
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"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
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();
carrier.noCase();
carrier.begin();
}
void loop() {
ArduinoCloud.update();
// Your code here
carrier.Buttons.update();
// Verify your thresholds
if (carrier.Buttons.getTouch(TOUCH0)) {
Serial.println("touching 0");
count++; //Increment the button0 variable in the cloud when the button is touched.
delay(500);
}
Serial.println(count);
delay(500);
}
/*
Since Count is READ_WRITE variable, onCountChange() is
executed every time a new value is received from IoT Cloud.
*/
void onCountChange() {
// Add your code here to act upon Count change
}
Here is my thingProperties.h:
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char SSID[] = SECRET_SSID; // Network SSID (name)
const char PASS[] = SECRET_OPTIONAL_PASS; // Network password (use for WPA, or use as key for WEP)
void onCountChange();
int count;
void initProperties(){
ArduinoCloud.addProperty(count, READWRITE, ON_CHANGE, onCountChange);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);