Sending realtime data EMG to my Android via BluetoothLE

I have tried the sketch that you sent and I have seen it in the app, but after I changed it so that it could appear as a graphic an error like this appears
image

That will be similar to your original LED Sketch, but you have to bear in mind that you can't send and receive at the same time (unless there are two communication channels between the hardware and the App). Think of a Bluetooth signal as water running through a pipe - it can't go in both directions at the same time.

However, lets not get ahead of ourselves - fix the current issue first.

Yes sir, let's do that :blush:

By the way, this is my blocks

That's Juan's department. Is there an example Project that you can study?

I can study from this sir, but like you said for graphics don't need to use a clock

That is interesting because this Block never updates the values - populate the Label first, then update the graph, then clear the Label (should not need to clear the Label but hey).

If that works, you could try using the stringValues directly in UpdateGraph..... if it fails, show us the exact content of the Label.

GetStringValues

You don't need to use a Clock in the App because the sending of data is already timed in the Sketch and the BLE blocks deliver the data accordingly. So omit the Clock but observe how the graph should be updated with the values.

image
That's the error sir, same error

Where do those '()' come from?

...we need to see the contents of the Label Muhammad -

For example, is it [(556,543)] or (556,543) or 556,543 ?

Edit: or something else - there seems to be a leading comma there


The content is like that sir, under the graph column

OK, not brilliant - it seems the BLE extension adds those parentheses.

CleanupValue

or:

Given that stringValues is a list as returned from the BLE block,
consider a

  • CSV Row From List or
  • JOIN WITH SEPARATOR ','
    conversion block to turn it into parentheses-free text.

Be aware that AI2 has native charts and graph components, that should not require extensions.

These blocks will deal with the ( ) problem by using a list block to extract your content from stringValues.

It will also settle a difference of opinion among Power Users as to where those ( ) came from.

1 Like

image
Maybe come from this sir?

Well, I just know it sir. And I don't understand about that extension is that added automatically or something?

No, ABG is correct - 'stringValues' is defined as an App Inventor List. We are not using it as a List.

It is because a List of values is expected and thus, if possible, should be processed as such. However, the Arduino is not delivering a List (two or more values sent one after the other), it is sending a concatenated String of two values to suit the graph extension, and therefore in this case 'select list item' might not work. However, you can try it, it works here if I make a test List of one, but my test is not using the value as received via BLE.

If 'select list item', does not work, we have to clean-up the String by removing the brackets, but it should work as per ABG's example.