Application not displaying correct graph with HC,05

I am creating an application interface that is supposed to display the cyclic voltammetry of whatever substance I have on hand using an electrode. When the graph runs however, it is just a straight line.
Below is the MIT code:
p9A0i_bluetooth_dinamico (1).aia (7.0 KB)

Below is the Arduino code:
Final_Design_to_Bluetooth.ino (2.0 KB)

Picture of blocks:

I appreciate the help in advance. Thank you

Can you get the values ​​coming from Bluetooth in a Label?


  • You never enabled Clock1, so it just sits there not testing for input.
  • There are new components in AI2 to draw graphs for you.
    FAQ Section: Charts and Graphs

//sends inputs to the Tx pin for bluetooth transmission.
void sendToBT(float x, float y) {

You are alternately sending x and y values to AI2 through BlueTooth.

How is your app to know which value is x and which value is y?

Pick one:

  • send messages that look like "x:4\n" or "y:32\n" and have your app check the front of each message (split at : and test item 1 of list)
  • send x ',' y \n each message and split incoming AI2 messages at ','

Standard Delimiter advice (check the last paragraph)

Please see the Delimiter article in FAQ

Be sure to use println() at the end of each message to send from the sending device, to signal end of message. Do not rely on timing for this, which is unreliable.

In the AI2 Designer, set the Delimiter attribute of the BlueTooth Client component to 10 to recognize the End of Line character.
Also, return data is not immediately available after sending a request,
you have to start a Clock Timer repeating and watch for its arrival in the Clock Timer event. The repeat rate of the Clock Timer should be faster than the transmission rate in the sending device, to not flood the AI2 buffers.

In your Clock Timer, you should check

  Is the BlueTooth Client still Connected?
  Is Bytes Available > 0?
     IF Bytes Available > 0 THEN
       set message var  to BT.ReceiveText(-1) 

This takes advantage of a special case in the ReceiveText block:

Receive text from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.

If you are sending multiple data values per message separated by | or comma, have your message split into a local or global variable for inspection before trying to select list items from it. Test if (length of list(split list result) >= expected list length) before doing any select list item operations, to avoid taking a long walk on a short pier. This bulletproofing is necessary in case your sending device sneaks in some commentary messages with the data values.

Dear @Leonard_Carpenter,
in addition to the two above answers you can also verify another couple of things:
the delay() function is completely blocking any other activity on the Arduino boards.
For example on the MEGA2560 it blocks even any serial communication, therefore I suggest you to use the millis() function instead, something like:

#define TIMEOUT xxxxx (the value that you want to wait)

unsigned long starttime = millis();

while ( (millis() - stattime) < TIMEOUT) {}; // it stays here but allows background activities
// do the rest of operations

If you don't use the Serial Monitor to show messages on the screen of your PC, then you can avoid using the SoftwareSerial to communicate with the HC05. You can use the Tx and Rx (the HW serial line of any Arduino board) because it is more reliable also at higher baudrates (the SoftwareSerial has erratical behaviours from 38400 onward). This, maybe, is not your case, because I see that you have set the serial interface toward the HC05 at 9600 baud, but are you sure that the HC05 has this baudrate set on its side ?
To be sure that the Arduino is working correctly, I typically suggest to use a serial terminal app on the PC, like Teraterm, that you can download freely and that helps you in understanding if the Arduino is sending out correctly the data.

I hope this can help you.

Multiply the value by 100.
value = value * 100