because it does not work I do not understand. bit shift

uint32_t j=255<<8;
Serial.println(j,BIN);

result Monitor Serial :11111111111111111111111100000000 =6400

uint32_t j=255<<15;
Serial.println(j,BIN);

result Monitor Serial :11111111111111111000000000000000 = 4294934528

uint32_t j=255<<16;
Serial.println(j,BIN);

result Monitor Serial :0 =0

uint32_t j=255UL<<16;

AND ??

uint32_t j=255<<24;

uint32_t j=255<<32;

Naruto128:
result Monitor Serial :11111111111111111111111100000000 =6400

That binary should be 4294967040 in decimal.
All the rest is OK.

Please be aware, that C has a default data type of “int” for numbers without any modifier. And ‘int’ on 8-bit AVR controllers is a 16-bit signed value.

What you (perhaps) wanted to do is bitshifting with ‘unsigned long’ values.

Perhaps:

  uint32_t j=255UL<<8;
  Serial.println(j,BIN);
  ...
  uint32_t k=255UL<<15;
  Serial.println(k,BIN);
  ....
  uint32_t l=255UL<<16;
  Serial.println(l,BIN);

If you take a 16 bit variable and shift all 16 bits like “255<<16” then you have shifted out all 16 bits and there are only 0 bits left. When doing afterwards a type casting from a 16-bit signed 0 to a 32-bit unsigne value, 0 stays 0.

11111111 255 0
111111110 510 1
1111111100 1020 2
11111111000 2040 3
111111110000 4080 4
1111111100000 8160 5
11111111000000 16320 6
111111110000000 32640 7
1111111100000000 65280 8
11111111000000000 130560 9
111111110000000000 261120 10
1111111100000000000 522240 11
11111111000000000000 1044480 12
111111110000000000000 2088960 13
1111111100000000000000 4177920 14
11111111000000000000000 8355840 15
111111110000000000000000 16711680 16
1111111100000000000000000 33423360 17
11111111000000000000000000 66846720 18
111111110000000000000000000 133693440 19
1111111100000000000000000000 267386880 20
11111111000000000000000000000 534773760 21
111111110000000000000000000000 1069547520 22
1111111100000000000000000000000 2139095040 23
11111111000000000000000000000000 4278190080 24
11111110000000000000000000000000 4261412864 25
11111100000000000000000000000000 4227858432 26
11111000000000000000000000000000 4160749568 27
11110000000000000000000000000000 4026531840 28
11100000000000000000000000000000 3758096384 29
11000000000000000000000000000000 3221225472 30
10000000000000000000000000000000 2147483648 31