Parsing Bluetooth Data for Cycle Count Display

Hey there,

I have an arduino reciprocating cylinder controller with a bluetooth controller. it automaticaly performs up down cycles. I want to take the cyclecounter variable and print it to the app inventor screen. but I have multiple things communicating along the bt serial so I need a way of recognizing eg. cyclecounter: 10.

maybe something like this but i cant find the blocks to achieve this.

if starts with "CycleCount: " receivedData
// Extract the cycle count number data
set cycleCountStartIndex to length of "CycleCount: "
set cycleCountData to substring receivedData from cycleCountStartIndex

   // Assuming you have a Label component named Label_CycleCount
   Label_CycleCount.Text = "Cycle Count: " + cycleCountData


BlueTooth_YAML_delimiter_sample.aia (3.5 KB)

initialize global message to



Hey thanks for showing me your code!

Can you show me what data you are sending from the arduino? how can i send a variable?

This is my code that sends characters on bt serial.

if (button5State == HIGH) {
        // button press dumps cylinder 

        digitalWrite(solenoid2pin, HIGH);
        // Mark and count cylinder dump
        cycleCounter++;
        totalCycleCounter++;
        // Send total cycle value to android app
        BTSerial.print("Total Cycle Counter: ");
        BTSerial.println(totalCycleCounter);
        delay(1000);

      } else {
        digitalWrite(solenoid2pin, LOW);
      }

My code should work for you if you take one of those two dictionary key/values (t,h) and reuse it with your prefix "Total Cycle Counter"

ok, I see.