List thinger switch, push button and diferents actuators

Hello, i wanted information about switch and push button actuators available in thinger. where do i find one list with several codes?

Thanks for your help

Sorry @ght777 but I can’t understand what do you mean

When I use switches to activate devices on thinger io, I find only fixed switches, I need a non-fixed, retractable push button switch that only works while pressed.

Thanks for your help

Hy @ght777,

OK, this is quite simple, you can program the behavior of the buttons in your device source code, please take a look at the example above, in which I’m building a push button behavior to toggle the value of a digital output, and also taking care about empty pson messages from the server connection:

 thing["Push_button"] << [](pson &in){
   if(in.is_empty()){
      in=false;  //when it is empty no changes are made
   }else{
      bool val=in;   
      if(val==true){
             digitalWrite(13,!digitalRead(13));      //new value will be the opposite as before  
       }
       delay(500);  //this delay is the time it will take for the button to return to its common position (off)
       in=false;
      } 
  };

Hope it helps

Dear Friend
Thanks for your valuable help, reviewing the solution that you suggested, I want to ask you about the following function:

digitalWrite(13,!digitalRead(13));

Why is the number 13 used? to which it corresponds.
Thanks for your reply

hahah sorry @ght777 it is the GPIO13 of my ESP8266… so you have to put there your LED_PIN, RELAY_PIN, Dx … what you want to control. Of course if you don’t want to control a digital pin, you can place there the instruction you want to be executed when the button is toggle

best

Good evening thanks for your help
effectively there is a change of state in operation.
But I would like to see graphically that the switch automatically returns to the off position. Is this possible?
Thanks again for your help.

yes! just put a lower value on the delay… with delay(0) it will be automatic. But it is no possible to do that in the widget configuration.

best