SensorValue not Displaying on Arduino Cloud SOLVED

Hello !

I am pulling my hair out over this one i am sure the solution is simple but i just cant seam to find it.

I have a MKR 1010 Its Connected to the Arduino IoT cloud and i have Created a Thingy and One variable called "int sensorValue" and set it to update every 10 seconds,

Yet in the dashboard it only shows 0,

Here is my main Code.

  Sketch generated by the Arduino IoT Cloud Thing "Untitled"

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  int sensorValue;

  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"

void setup() {
  // Initialize serial and wait for port to open:
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
   // Set 12bit read resolution
  // Defined in thingProperties.h

  // Connect to Arduino IoT Cloud
     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

void loop() {
  // Your code here 
  int sensorValue = analogRead(A1);
  Serial.print("sensorValue = ");

I just want to simply display the Analog coming from my A1 pin.

In the serial monitor i can see the voltage perfectly over and over printed but i just cant get it to show up in the cloud variable.

What am i doing wrong ?


Issue was variables inside a loop () are seprate from global, even if they have the exact same name are separate from global variables.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.