Shorts received despite not sending anything from arduino BLE

PillboxIteration.aia (206.1 KB)

image

This piece of code is getting activated despite my arduino not sending any values to this characteristic.
image

It occurs when this piece of code activates, my arduino does not have any code that writes to the characteristic where the shorts are being received.

Here is the arduino code that is primarily affected by this, the rest are in this file
BLE_2.0.ino (4.8 KB)

Can anyone help to find out why this is occuring?

When/Where are you starting the clock?

Hi TIMAI2 I am working with Bernon on this project and these are the blocks for all the clocks used in these project which start immediately after connecting to the AI Companion

Clock 1 is set to 60000ms
Clock 2 is set to 1000ms
Clock 3 is set to 60000ms

Is the clock running as soon as you start the app?

Yes it is :slight_smile:

That's because you left it enabled in the Designer.

Sorry left what enabled in the designer ? timeralwaysfires?

Clock 1.Enabled

Does your app sound like a Cuckoo clock factory delivery van?

I disabled it but the result remains the same.
Im not sure what your second sentence means

For most situations, you should only start a clock timer when you need to run it, that is, it is started by some user action (clicking a button, etc.)

There are occasions where you may want the clock timer to start with the app, for example, to start a counter to assess elapsed time. But I do not believe this is one of those occasions

Untick TimerEnabled in the Designer for all your clocks:

image

You can then start and stop them, as required, using the timer enabled block:

image

If that doesn't work, export and post your aia file.

P.S. Disable all 3 of them.
image

Ah but it needs to be running when the app is opened as the function is to display the current time, and when the user sets a reminder, it compares the user set time to the current time. Firing the BLE command if the two times are equal. The problem lies as when the BLE command fires, it somehow affects the shorts received block. I will try to add an if statement to make sure the shorts received block does not fire randomly.
image

But when i send an uint32_t of 1 to mit app,
image

I receive a weird () as the int and it does not fulfill the if statement. Do y'all know why this happens ?


BernonIteration (1).aia (206.1 KB)

The () are a pre-JSON empty list.

Probably you aren't selecting from the list incoming BLE messages?

Will know after breakfast.

1 Like

I think it may have something to do with the fact that the characteristic that it writes into is the same characteristic that MIT APP uses for another function (writing PillData), i will try to create a new characteristic for this SMS function so that there will be no interference, however i remember trying something like this in the past, will try again after dinner haha

It is good practice to stick with the default Project Properties of showing lists as JSON.

They are better at showing data types and demarcations than the older systems that AI2 used.

Regarding your blocks:

Notice the trailing 's' in the variable name intValues ?

That tells you it's a list, even if you don't read the tool tip or the docs.

The comparison intValues = 1 is outside of the capabilities of the AI2 math = block, and defies common sense too.

What should equal 1?

  • The first item in the incoming list of ints?

  • The length of that list?

  • The number of digits in the first int value?

1 Like

Thanks for the help abg!!, i have turned the JSON list setting on and after abit more testing and creating a new characteristic for it . I have sucessfully sent the SMS at the correct time i want it to. I think the error was due to me having tried to make 1 characteristic have two functions that interfered with one another.

1 Like