shiftOut() using shorts/longs

(deleted)

does the function take the most significant bit from the original variable (so always 0 for numbers < 255) or does it take it from only the smallest 8 bits of it (so 1 if the number >127)?

What do you think the third parameter of the function does ?

(deleted)

jaskamakkara:
Is that how it works?

EDIT - the reason I ask is because shiftOut() only shifts out a single byte, so I am unsure how it deals with shorts and ints etc that are still <255 in magnitude.

the function takes an unsigned 8 bit value, a byte in Arduino.

if you put some other type into the function, it will be implicitly converted to a byte.

if you are using other data types, you should select the 8 bits you want to send...

See bit manipulation

(deleted)

jaskamakkara:
That would seem to make sense to me, but I can't find a reference that confirms it.

you can confirm it by casting yourself:

void setup() 
{
  Serial.begin(9600);
  uint16_t value = 0xDEAD;
  Serial.println((byte)value, HEX);
}

void loop() 
{
}

output:

AD

(deleted)

Well, that's literally my question. The MSB of a short/int would be the 16th bit,

That is irrelevant. As you've learned, the function takes a byte. The MSBFIRST value tells the function to shift the most significant bit out first, then the second most significant bit, up to the least significant bit OF THE BYTE.

(deleted)

Where myData is a short or long variable (but still <= 255 in magnitude),

If you know that that value will be <= 255 then is it necessary to use a larger data type in the first place ?

(deleted)