Push button like Blynk app

Is it possible to make a multiple clicks i.e. a push-button (just like the Blynk app) which works like,
Single tap ON, another tap OFF

Thank You !

You can make a variable ā€œStateā€ which default value is Off. SO when button 1 click if global state = off then set button text to on and set state to onā€¦ Hope it helped :blush: !!

1 Like

:point_up_2: He wants to do multiple functions with one button

What you are doing is using two buttons. He asked for a way to use one button with two states just like @Tekwizer explained.

4 Likes

I am still a learner :pensive: :pensive:

1 Like

Just something like this will do.

image

3 Likes

One more smart way :grin:

blocks(6)

5 Likes

Much smarter :+1: :wink:

1 Like

This is the first time I see this ā€œIf then elseā€ block in use.

2 Likes

It doesnā€™t seems useful when you donā€™t know about it. When I donā€™t know about this block then it seems useless for me. But when I understand this block and usage then it is very useful for me now.
There are many smarter way to work with these blocks. And really I love playing with these type of block that uses 100% of our mind.

4 Likes

Can you help with the blocks?
Iā€™m just a beginner here and tried but doesnā€™t seem like iā€™m doing it right.

1 Like

image

Why donā€™t you show what you have tried? It is much easier to help you.

Most of the times his reply always with simple blocks ā€¦ his solution will thinks as, Oh this like and all we could use the blocksā€¦

As per the @iamwsumit answer you can set the text on the button.

If you follow @Peter answer answer you could add the following up process for ON and OFF

I tried this with a little piece of blocks. It is too easy

Blocks

blocks(11)

Output

Understand the logic and made the blocks. It is just of 2 minutes.

2 Likes

A more simple method ā€‹would be to have 2 buttons one for on and one for off
On button will be visible true and off button will be visible false.
Like this
SmartSelect_20210702-110206_Chrome
Unfortunately though, i cant show you the resault cause the build servers are down again LOL

This is exactly what i did, but needed a better and effective solution

yea sometimes visible property gets stuck and doesnt changeā€¦a more effective way which for me it works, is to change the button height like this
SmartSelect_20210702-111235_Chrome
The zero height will make the on button disapear.
And if we set the on button height to its own height will make it apear and visa versa.
Now if your alignment is horizontal, you can do the same thing with the width instead