Hello,
I'm beginning with Arduino IoT Cloud, and I have difficulties with it.
I started using my new Arduino Nano 33 IoT on the classic IDE. I added a LED with a resistor on one pin (14) and a potentiometer on an other pin (A2). Everything work nicely on the IDE on the computer. I can read the value of the potentiometer and make the LED blinks. So my circuit seems to be correct.
I started having issue when I tried to use the IoT Cloud. I have followed this tutorial. I manage to turn ON and OFF the built in led on pin 13 using the dashboard.
However I'm unable to turn on the LED on pin 14. I defined the variable light14 with the same parameter as the variable light for pin 13, copied and adjusted the function in the program. I added a button on the dashboard. But when I click on it, nothing happens. I checked the pin with a voltmeter, who indicates 0V no matter the position of the switch on the dashboard.
I have a similar issue with the potentiometer. I created a variable as read only, with periodic update. I added a gauge on the dashboard and connected it to the variable. But the gauge always shows the same value - apparently the first measurement after uploading the program in the card. I also checked with the voltmeter. The tension of the pin varies with the position of potentiometer.
Does anyone have a clue ?
/*
Sketch generated by the Arduino IoT Cloud Thing "Simple Blink"
https://create.arduino.cc/cloud/things/7ae591fd-5e0b-445b-a44d-09b9b742e5fe
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
bool light;
float potentiometre;
bool light14;
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"
int PINLED = 13;
int PINLED_14 = 14;
byte PIN_POTENTIOMETER = A2;
void setup() {
pinMode(PINLED, OUTPUT);
pinMode(PINLED_14, OUTPUT);
pinMode(PIN_POTENTIOMETER, INPUT);
// 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();
}
void loop() {
ArduinoCloud.update();
// Your code here
}
void onLightChange() {
// Do something
digitalWrite(PINLED, light);
Serial.print("The light is ");
if (light) {
Serial.println("ON");
} else {
Serial.println("OFF");
}
}
void onLight14Change() {
digitalWrite(PINLED_14, light14);
Serial.print("The light 14 is ");
if (light14) {
Serial.println("ON");
} else {
Serial.println("OFF");
}
}
void onPotentiometreChange() {
// Do something
int val = analogRead(PIN_POTENTIOMETER);
potentiometre = val / 1024. * 100.;
}
The definition of the variables :
The dashboard :





