Bit array out of scope error

hey guys, I am trying to follow an arduino tutorial, specifically this one on bit operations.

http://playground.arduino.cc/Code/BitMath

specifically the part about saving memory by saving things as bits. I pretty much copied the code only changing the numbers to suit my needs but i am getting this error.

'B00001100000110000' was not declared in this scope

which highlights the last line of this code block.

const uint32_t BitMap[5] PROGMEM = {
B00001100000110000,
B00011110001111000,
B00011110001111000,
B00011110001111000,
B00001100000110000
};

Googling only showed that this block should be outside of setup, which it already is. Any help would be much appreciated.

All B... are Arduino specifically defined constants (in binary.h) You used one which is not defined.
You can use hexadecimal (0x...) representation it is the same.
Binary constants are not 'supported' in C/C++ by default, only decimal, octal (0...), and hexadecimal (0x...). But can be defined by user, of course. You want to use 32bit binary but to make it universal, means that each value should be defined somewhere. It is pretty much for definition. Look at the binary.h how about just 8bit.

Arduino style binary notation doesn't go that high. You need to use GCC style binary notation instead:

const uint32_t BitMap[5] PROGMEM = { 
    0b00001100000110000,
    0b00011110001111000,
    0b00011110001111000,
    0b00011110001111000,
    0b00001100000110000
};

pert:
Arduino style binary notation doesn't go that high. You need to use GCC style binary notation instead:

const uint32_t BitMap[5] PROGMEM = { 

0b00001100000110000,
    0b00011110001111000,
    0b00011110001111000,
    0b00011110001111000,
    0b00001100000110000
};

Thank you so much. That worked perfectly. On to the next error :slight_smile: