School project: (How to use a Clock to disable a Button while using BlueTooth?)

I've been dealing with a school project in the last couple of weeks, but I've encountered an specific problem that I'm stuck with. In the project we have to make a pill machine, and for that we have to set a timer. When the timer's hour and the actual hour are the same, a message has to be sent to Arduino. My progress so far is the following one:

The thing is that if I select an specific hour and minute, I want a message to be sent (JUST ONCE) when, in the clock, it shows that time. But that doesn't happen as the message is sent 60 times. My hypothesis is that this happens because a specific minute matches up (in bouth) for 60 seconds; thus, the message is sent 60 times.

Please help me find a way in which the message is sent just once.

Show down your Clock to update just once a minute (ms = 60000)
or add seconds to the comparison.

1 Like

How would I add seconds to the comparison?

On the right
blocks (1)
and on the other side
blocks

It doesn't work that way. It just does nothing. In the previous situation, I saw that the message, at least, had arrived as I have some LEDs that light up. Now nothing happens. Just in case, this is the current state:

You might be missing a trailing zero on the seconds, or overshooting the exact match moment.

There is a FormatTime block in the Clock that you can use to force double digits, and avoid that five-way JOIN. (You already use that, I see.) So if you ask the Time picker for an Instant, you can compare two FormatTime results.

If the seconds don't help, you could avoid the extra 59 hits by also disabling the associated button when you get the match, to make subsequent tests fail the AND.

And how would I disable the button?

Look in the same place where you got the Button.Enabled block, and look for the
set Button.Enabled block.
Set it to false (green block.)

Hi, I've been trying to do that, but still it does nothing. Would you send me that (the button dissabled) attached to the work already done. This one:

Export your .aia file and upload it here.
export_and_upload_aia

Hi, I apologize for not being connected these days. Here it is the .aia file:

TEKNO.aia (9.6 KB)

As you can see, I have done some small changes in the proyect. Now, I've added an additional button that would set the Button.Enabled to, once again, true. I am extremely grateful to say that, because of your help, now, the proyect works. There is a small thing, though.

If, for instance, I click in the button 3, and, afterwards, I select the hour (and when the actual hour and the hour set match), it still sends the same message (called "A") that would send in case I had selected button 2. In this case, the message that it would have to send would have to be "E".

The same happens with buttons 5,7 and 9.

The blocks in the aia project are different from the blocks shown here. There you have each sending procedure in a different clock. Here you show two procedures in one timer. Why use multiple clocks when you can do it with one clock?

I have done it like (in multiple clocks) because I do not know have to do it in just one.

See what happens with one clock:

TEKNO.aia (9.2 KB)

You still need to add button support.