I'm working with LED Matrix display, trying to encode animation in 32 bit array.
Something is strange is happening tho, when I try to shift bits.
const unsigned long PROGMEM bitmap=0x280A00;
void setup() {
Serial.begin (115200);
unsigned long rowDots = pgm_read_dword_near(&bitmap);
for (byte col=0; col<32; col++)
{
if (rowDots & (1<<(31-col)))
Serial.print (1);
else
Serial.print (0);
}
}
0x280A00 should look like this in binary:
00000000001010000000101000000000
Instead I get:
00000000000000001000101000000000
I'm not sure I get syntax of rowDots & (1<<(31-col)). I know it supposed to shift rowDots left by specified number of bytes...