Mbed Compiler Error

Hi! I have imported an LED blinking code to get started with mbed online, but I am getting the following error:

Error: Fatal error: C3903U: Argument ‘Cortex-M4.fp.sp’ not permitted for option ‘cpu’.

Any ideas on how to get around this?

The following is the code I’ve imported from the “demo_program” file in mbed:

#include "mbed.h"

DigitalOut myled(LED1);
DigitalOut newled(LED2);
DigitalOut newled(LED3);
DigitalOut newerled(LED4);

int main() {
while(1) {
myled = 1;
myled2 = 1;
newled = 1;
newerled = 1;
wait(0.5);
myled = 0;
myled2 = 0;
newled = 0;
newerled = 0;
wait(0.5);
}
}#

Regards,

Muana Kaso

Not sure which demo file you are using and which board, but you will get a ‘redefinition’ error on that

DigitalOut newled(LED3);

Also you can’t use

wait() or wait_ms()

any more, but you can use

wait_us()

However you should be using

ThisThread::sleep_for( time in miliseconds)

So it should look something like this:

#include "mbed.h"

DigitalOut myled(LED1);
DigitalOut myled2(LED2);
DigitalOut newled(LED3);
DigitalOut newerled(LED4);

int main() {
    
    while(1) {
        myled = 1;
        myled2 = 1;
        newled = 1;
        newerled = 1;
      //  wait_us(500000);
        ThisThread::sleep_for(500); // miliseconds
        myled = 0;
        myled2 = 0;
        newled = 0;
        newerled = 0;
      //  wait_us(500000);
        ThisThread::sleep_for(500); // miliseconds
    }
}