Mistake on this page?
Report an issue in GitHub or email us

Bare metal example

To enable Mbed OS bare metal, create an mbed_app.json with the following contents:

{
    "requires": ["bare-metal"]
}

To learn about using the bare metal profile on Mbed OS 5, please see the Blinky bare metal example:

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

#include "mbed.h"

#define WAIT_TIME 500 //msec

DigitalOut led1(LED1);

int main()
{
    while (true)
    {
        led1 = !led1;
        thread_sleep_for(WAIT_TIME);
    }
}

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.