LEDA should be flashed as follows: 3 flashes at 250ms intervals followed by 3 flashes at 1sec intervals and then repeat continuously. Do this using the Timer or Ticker API to ensure the response time of the potentiometer is not affected

if(t.read_ms()==250){
if(x<=5){
leda=!leda;
t.reset();
x=x+1;
y=y+1;
}
}
}

       if(t3.read_ms()==1000){
              if(y==3){
                  if(o<=5){
             leda=!leda;
             t3.reset();
             o=o+1;
                  }
          }

Hi,

You can use EventQueue API for a periodic event. e.g. call every 250ms.

/* mbed Microcontroller Library
 * Copyright (c) 2019-2022 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */

#include "mbed.h"

DigitalOut led(LED1);
EventQueue queue;

int state = 0;
int state_next = 0;

/*
LED blink  : * _ * _ * _ *       _       *       _       *       _
state      : 0 1 2 3 4 5 6 6 6 6 7 7 7 7 8 8 8 8 8 9 9 9 A A A A B B B B
state_next : 0 0 0 0 0 0 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
*/

void blink_handler() {
    if (state <= 5) {
        led = !led;
        state++;
    }
    else {
        if (state_next == 0) {
            led = !led;
            state++;
        }
        if (state_next <= 3) {
            state_next++;
        } else {
            state_next = 0;
        }
        if (state == 0xC) {
            state = 0;
        }
    }
}

int main()
{
    queue.call_every(250ms, blink_handler);
    queue.dispatch();
}

I hope this helps.

Thanks,
Toyo