9 years, 5 months ago.

Problem with binary numbers

Hi I'm using stmf411re nucleo mcu and I have following problem .

Problem with binary numbers

#include "mbed.h"

BusOut leds(D9, D8, D7, D6, D5, D4, D3, D2);

float x = .1;

int main(void) {
    leds = 0b11001100;
    wait(1);
    while(1);
}

. after trying to compile i got error :

Error message

Error: Expected a ";" in "main.cpp", Line: 9, Col: 14

1 Answer

9 years, 5 months ago.

The 0b prefix is sadly not defined in the mbed compiler (same for many others tbh). I like it to, but only octal, hex and decimal systems are supported.

Accepted Answer

Thanks for Your answer, I'm very suprised, because in compiler numbers are colored red and also binary number as 0b0011 is colored red.

posted by Michał Szymocha 26 Jun 2015