Arduino Iot Cloud help

Hello everybody,
I made an application on the Arduino Cloud IOT that has three buttons that turn on a dimer at 50, 100, and 0%, now I would need to put an icon that warns the status of each stage, that is, stay ON for example as long as a button is pressed indicating that that stage is being used, and if another button that corresponds to another stage is pressed, another status indicator stays on.
The buttons part I've already done and it works, but I don't know how to do this part, if anyone can and wants to help me, I'd really appreciate it.

My code

/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/9298f7e1-ab11-492b-a850-99fc53f3159f 

  Arduino IoT Cloud Variables description

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

  CloudSwitch botao0;
  CloudSwitch botao100;
  CloudSwitch botao50;
  CloudSwitch estado0;
  CloudSwitch estado100;
  CloudSwitch estado50;
  CloudSwitch teste;

  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.
*/
int b0   = 2;
int b50  = 4;
int b100 = 12;



 int s0;
 int s50;
 int s100;

#include "thingProperties.h"

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); 
  
  pinMode (b0, OUTPUT);
  pinMode (b50, OUTPUT);
  pinMode (b100, OUTPUT);
  
 
  
  // 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 
  
}

/*
  Since Botao0 is READ_WRITE variable, onBotao0Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onBotao0Change()  {
  // Add your code here to act upon Botao0 change
  
 
  
  if(botao0)
  {
    digitalWrite (b0,LOW);
    delay(4000);
  }
  else
  
  {
    digitalWrite (b0,HIGH);
  }
}

/*
  Since Botao50 is READ_WRITE variable, onBotao50Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onBotao50Change()  {
  // Add your code here to act upon Botao50 change
   if(botao50)
  {
    digitalWrite (b50,LOW);
    delay(4000);
  }
  else
  
  {
    digitalWrite (b50,HIGH);
  }
}


/*
  Since Botao100 is READ_WRITE variable, onBotao100Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onBotao100Change()  {
  // Add your code here to act upon Botao100 change
   if(botao100)
  {
    digitalWrite(b100,LOW);
    delay(4000);
  }
    
    else
    {
   digitalWrite(b100, HIGH);
 
  }
  
}
    

/*
  Since Estado0 is READ_WRITE variable, onEstado0Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onEstado0Change()  {
  // Add your code here to act upon Estado0 change
  
}

/*
  Since Estado50 is READ_WRITE variable, onEstado50Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onEstado50Change()  {
  // Add your code here to act upon Estado50 change

}

/*
  Since Estado100 is READ_WRITE variable, onEstado100Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onEstado100Change()  {
  // Add your code here to act upon Estado100 change
 // s100 != b100;
  
}





/*
  Since Teste is READ_WRITE variable, onTesteChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onTesteChange()  {
  // Add your code here to act upon Teste change
}


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