Change state of dashboard switch with command?

hi, i have a small question, is there a command to change state of dashboard switch ?
like, if my variable is bool, can i change it with a command ?
thanks

type casting

@lafleche_2 what do you mean by command? You can change the state of a switch simply changing the state of the attached boolean variable on your thing sketch

ho sorry for my english, its not my fisrt languange, that exactly what i mean ! i want to change the state of the bool variable in the sketch, but i dont know how... i know that a newbe question but i'll apreciate your help :slight_smile:

No problem!

to change the state of a boolean variable you can simply assign it to true or false
example:

bool state;
state = true; // or state = false;

if you have an Arduino board, the most straightforward way to have a very simple complete project to get started to by going to the templates section of IoT Cloud, clicking on "Cloud Blink" and following the wizard. At the end you will have a working dashboard with a switch button to turn on and off your led builtin.

Hope this helps, for more complete getting started guide you can check our documentation

1 Like

it work !! thanks a lot !!

1 Like

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