The operation add item to list cannot accept the argumants

hey all,

every time I hit the 'start' button Im getting this massage:

basicly my app is reciving sensor reading (value only) via ble and suppose among other stuff to save the highest value on each loop.
dose any one know what Im missing?
and dose the canvas blocks are right?

The problem is that global CTAR_DATA is not a list, most probably global CTAR_DATA is set to 0 and that's why you get this error like in the example below. Try to use Do it to debug your blocks

this is how I defined global CTAR_DATA:
is there another way to define a new list variable?

Maybe you initialize global variable to create an empty list but at some point set it to 0. I can not see all your blocks, I'm only guessing. Use Do it and post a screenshot of get global CTAR_DATA

Yes, as @dora_paz says.

You initialise your variables as lists, but then you set them to strings (why?), so your variables become strings and are no longer (empty) lists, therefore you cannot add items to them (as a list).

This is what I got.

DTD.aia (206.9 KB)

I uploaded the app mybe it will be easier to find whats wrong

Not really, because your app connects to a bluetooth device of some kind and fetches data.

Show an example of the data your receive that is captured in global Sensor_Value.

Here are the contradictory ways you treat global SENSOR_VALUE:

as a list of numbers (that is what this event returns)

blocks (1)
as a single number

again as a single number

the big picture.

You must learn the blocks that deal with lists and the items in them.

so if I want to update the value of the variable every time the app recives new data, so I will have only one numbre at all time. how do I do it?

This app can't be understood unless the data collection technique is clarified.

How many bytes arrive at each bytesReceived event?

  • enough to plot as a graph, or
  • just a few, that need to accumulated for later graphing from a longer list?

Also, please define

  • CTAR
  • JOR
  • Q_JOR

I have connected a force sensor to an arduino nano and sanding the reading from the sensor every 0.5 sec to the app via BLE, so it suppose to be a single integer every 0.5 sec.
the variables are the amount of loops (repetitions) needed to be made on each exercise.

In that case, define a procedure (copied from the guts of your Start button Click event) that accepts a single Sensor_VALUE , and call it from the BLE BytesReceived event as follows:

when BLE.BytesReceived
  for each byte in byteValues
     set global Sensor_VALUE to byte
     call the graphing procedure with Sensor_VALUE
  end for each
end when BL.BytesReceived

I just noticed something from your data log.

Your data stream has numbers with decimal fractions.
How did you expect them to appear as bytes, which are integers?

Post your sketch, so we can see how you format the data stream.
I suspect the app should be receiving strings, not bytes.

1 Like

I just changed it to floats received.
that should be fine no?

How do we know what is being sent without the sketch that sends it?

#include <ArduinoBLE.h>

#define BLE_LOCAL_NAME "DTD_1"

int red = 11;
int green = 10;
int blue = 9;
float sensor = A0;
float cf = 19.5; // caliberation factor
float pressureReading;

BLEService BLESensors("00001101-0000-1000-8000-00805F9B34FB");
BLECharacteristic pressureBLE("000B", BLERead | BLENotify | BLEBroadcast, BLE_BUFFER_SIZES);

void setup()
LedColor (0,255,0);
while (!Serial);

// begin initialization
if (!BLE.begin())
Serial.println("starting BLE failed!");

while (1);


// set the local name peripheral advertises


// start advertising

Serial.println(("Bluetooth device active, waiting for connections..."));

void loop()

// listen for BLE peripherals to connect:
BLEDevice central = BLE.central();

// if a central is connected to peripheral:
if (central) {
Serial.print("Connected to central: ");
// print the central's MAC address:

// while the central is still connected to peripheral:
while (central.connected()) 
  for (int i=0;i<10;i++)
        float Reading = analogRead(sensor); 
        pressureReading = pressureReading + Reading;
        delay (50);
      pressureReading = pressureReading / 10;
      pressureReading = (pressureReading * 5.0) / 1023.0;
      pressureReading = pressureReading * cf;


      pressureReading = 0;

// when the central disconnects, print it out:
Serial.print(F("Disconnected from central: "));

void LedColor(int redL, int greenL, int blueL)
analogWrite(red, red);
analogWrite(green, green);
analogWrite(blue, blue);

This tells me you should be expecting Strings, not Bytes or Floats.

So after alot of reading and reserch and even more help on the Arduino forums I manged to send data from the arduino and read it on BLE Scanner using this code:

#include <ArduinoBLE.h>


#define BLE_UUID_SENSOR_SERVICE "82D20000-87F8-C79D-9E63-A091F4171879"
#define BLE_UUID_PRESSURE "82D20001-87F8-C79D-9E63-A091F4171879"

// BLE

#define BLE_DEVICE_NAME "Arduino Nano 33 IoT"
#define BLE_LOCAL_NAME "Arduino Nano 33 IoT"

BLEService sensorService( BLE_UUID_SENSOR_SERVICE );
BLEShortCharacteristic pressureCharacteristic( BLE_UUID_PRESSURE, BLERead | BLENotify );

// I/O and App


uint16_t averagePressure = 0;
bool updatePressureCharacteristic = false;

void setup()
Serial.begin( 9600 );
while ( !Serial );

analogReadResolution( 10 );

if ( !setupBleMode() )
Serial.println( "Failed to initialize BLE!" );
while ( 1 );
Serial.println( "BLE initialized. Waiting for clients to connect." );

void loop()

void sensorTask()

static uint16_t sampleBuffer[SAMPLE_BUFFER_SIZE] = { 0 };
static uint32_t previousMillis = 0;
static uint32_t sampleIndex = 0;

uint32_t currentMillis = millis();
if ( currentMillis - previousMillis >= SENSOR_SAMPLING_INTERVAL )
previousMillis = currentMillis;
uint16_t currentPressure = analogRead( PRESSURE_SENSOR_PIN );
sampleBuffer[sampleIndex] = currentPressure;
sampleIndex = ( sampleIndex + 1 ) % SAMPLE_BUFFER_SIZE;

if ( sampleIndex == 0 )
  uint32_t bufferTotal = 0;
  for ( uint32_t i = 0; i < SAMPLE_BUFFER_SIZE; i++ )
    bufferTotal += sampleBuffer[i];
  averagePressure = (uint16_t) round( bufferTotal / SAMPLE_BUFFER_SIZE );
  updatePressureCharacteristic = true;


bool setupBleMode()
if ( !BLE.begin() )
return false;

// set advertised local name and service UUID
BLE.setDeviceName( BLE_DEVICE_NAME );
BLE.setLocalName( BLE_LOCAL_NAME );
BLE.setAdvertisedService( sensorService );

// add characteristics
sensorService.addCharacteristic( pressureCharacteristic );

// add service
BLE.addService( sensorService );

// set the initial value for the characeristics
pressureCharacteristic.writeValue( averagePressure );

// set BLE event handlers
BLE.setEventHandler( BLEConnected, blePeripheralConnectHandler );
BLE.setEventHandler( BLEDisconnected, blePeripheralDisconnectHandler );

// start advertising

return true;

void bleTask()
static uint32_t previousMillis = 0;

uint32_t currentMillis = millis();
if ( currentMillis - previousMillis >= BLE_UPDATE_INTERVAL )
previousMillis = currentMillis;

if ( updatePressureCharacteristic )
updatePressureCharacteristic = false;
pressureCharacteristic.writeValue( averagePressure );

void blePeripheralConnectHandler( BLEDevice central )
digitalWrite( BLE_LED_PIN, HIGH );
Serial.print( "Connected to central: " );
Serial.println( central.address() );

void blePeripheralDisconnectHandler( BLEDevice central )
digitalWrite( BLE_LED_PIN, LOW );
Serial.print( "Disconnected from central: " );
Serial.println( central.address() );

I created a simple app to check if I can read the data that is being sent and with no luck.

as you can see I tryed several diffrent blocks with no luck.
what am I missing?