Tasks Example

LED/UART Runtime

Demonstrate two readable RTOS tasks: one reports over serial, while one changes the LED state.

Board LPCXpresso51U68 EVB OM40005
Status Verified

Run It

Use these commands from the COS workspace when the board and serial adapter are attached.

make -C firmware/lpc51u68_cleveros_boot clean allmake -C firmware/lpc51u68_cleveros_boot flashpython3 tools/uart_viewer.py --device <serial-device> --baud 9600

What To Look For

  • Application code stays in task functions.
  • The LED task and serial task run independently.
  • The demo is the easiest user-facing CleverOS example.
static void task_uart(void)
{
    uint32_t count = 0u;

    for (;;) {
        rtos_log_task_state("rtos task0 uart tick ", rtos_tick_ms(), count++);
        rtos_delay_ticks(1000u);
    }
}

static void task_led(void)
{
    cos_lpc51u68_led_step_t step = COS_LPC51U68_LED_STEP_RED;

    for (;;) {
        rtos_set_led_step(step);
        step = (cos_lpc51u68_led_step_t)(((uint32_t)step + 1u) & 0x3u);
        rtos_delay_ticks(1000u);
    }
}