the shiftOut() command with dataPin, clockPin, bitOrder, value) makes a lot of sense but I do not understand in the "Hello World" example of shift out the clock is pulsed. Would pin 12 (clockPin) look like a clock if an oscope was hooked up to it? Does anyone have a timing diagram to illistrate this command?
Any reason this wouldn't be faster and easier to read -
The function quoted above is part of Arduino-0018. You normally don't need to read it to use it. (I would have written (128 >> i) rather than (1 << (7 - i)) though)
I don't think there would be any noticeable difference in speed, as it is the calls to digitalWrite and not the bit shifting that consumes the time.
the compiler's strength-reduce optimization will also most likely fix the code such that only one shift per loop is required in either case.
The current code is also smaller, which is important on a microcontroller.
If speed is important, SPI, direct port manipulation and inline assembler are better options.
But I realize what looks like simplified code may not generate smaller object code. Is there a tool that can be used to determine code size and or something to determine cycle counts for our code. Other than doing timing tests?