Disabling switch in MIT app inventor

Hello, I would like my Switch button not to change states if the Bluetooth is not connected
I used Switch Enable False but it always changes state when pressed
I would like some help Thanks

Can you send your blocks

1 Like

I can't spot the error can you send the aia file of the project plz :pleading_face:

1 Like

@gordonlu310 can you help in this??

1 Like

To take a screenshot properly on your computer, right-click the blocks that you want to screenshot (or an empty space if you want to screenshot everything), and select "Download blocks as PNG".

You said 'it always changes state when pressed' does that mean the Switch changes from true to false or false to true randomly? Switch
Do you use the Switch.Changed block?

You use a Procedure DisableSwitch. How do you call it periodically? Are you using a Clock to constantly poll to determine if IsConnected is true or false? If you do not, how you use DisableSwitch is probably your problem.

Yes, switch goes true to false or false to true randomly
Light switch

Yes, I use the Changed block

I use DisableSwitch procedure during ScreenInitialize only for now

No, I don't use a clock for the procedure call

Something similar happened to me. It turns out the switch was indeed being disabled, however because I chose a black background and white lettering, you couldn't visibly tell that was happening in the app. When I changed the color arrangement, it worked as expected.