How to make the LED automatically turn off with a countdown

I made a LED control using a timer, to turn on it can be with a timer while it can't turn off. so the LED stays on when the time is 0

Are you using Arduino?Bluetooth? Show the blocks of your app.

It is not a good option to use two Screen in the Bluetooth connection, use virtual screens.

https://community.appinventor.mit.edu/t/bluetooth-hc-06-arduino-send-receive-send-text-file-multitouch-image/9518/12

my problem is bluetooth not sending 0 after time shows 0

You have some type mismatches that cause problems:

  • n = false in one place, n tested for 0 in another. Use default 0 ?

  • N1-n4 returned from TinyDB default value as ' ', then tested against 0. Use default 0 instead.

Hello Muhammad

Next time you upload an image of your Blocks, please use the App Inventor function for this purpose - your Screenshots are difficult to read.

Right-mouse in the Blocks work area and select "Download Blocks as image"
download blocks

This is wrong, the List is already populated:
Snap039

You can do this:

This is also wrong:
Snap040

  1. You can't enable Clock1 Timer there, the Timer has to be already enabled to run anything in it's 'when' Block.

  2. What is the variable 'n' for exactly?

  3. Before sending, you must check that the Client is connected.

  4. Does this Timer only get fired once or should it keep on sending the value 48 until enabled = false?

  5. The other Clock Timers - what are they for?

for number 1 it has been deleted, and for number 2 n it is a variable for the countdown timer, and for problem number 3 how to check the client is connecting?
for number 4 I saw in many tutorials to turn off using the value 48

for other clock timers because there are 4 countdown calculations
chrome_FMvRRjD8Al

ok i will try it

i have problem with When the slider in the app is moved an error appears "Error 515: Not connected to a Bluetooth device".what's the solution?

what I mean is when the countdown timer has shown a value of 0 then the led will turn off

That's better, though the Timer should disable itself after the BT send and 'n' has no effect at all.

So like this:
blocksClock

Other Time count downs - you have other LEDs?

yes, i have another led. the first led can countdown timer but after I add another led can't run the countdown timer. only the first one runs.


Change both Clock Timer Blocks to the code in my example - that would at least give you valid code - how do you trigger the Clock Timers? With Button Clicks?