hi i am trying to use more than 3 74hc595 shift registers to power LED's directly. i have two shift registers working by
splitting the bit into 2 bytes as shown below:
i am daisy chaining the shift registers with the data running through all of them in the chain, however the problem i have is getting them to react individually to the data sent.
Assuming (because you haven't shown us) that "bitsToSend" is an "int", then the answer is that there aren't any more bytes.
An "int" is 16 bits, or two bytes long.
Or, if it's a "long", simply shift right 16 bits and mask with 0xFF.
If you just have two bytes, you can get away with using one 16-bit integer value and splitting it with highbyte() and lowbyte(). For more than two, things become impractical, in that case you better define a byte array and shift that out.
So your code will look something like this:
const int daisylength = 3;
uint8_t daisydata[daisylength];
void loop() {
...
// Setting some bits
daisydata[2] |= 0x43;
...
// Send out data
for (int i = 0; i < daisylength; i++) {
shiftOut(dataPin, clock, LSBFIRST, daisydata[i]);
}
// Latch etc.
....
}
Then you can increase your daisy-chain by simply increasing the value of daisylength and adding the necessary hardware.
which means that daisydata[2] will have all bits of the hexadecimal 0x43 (01000011 in binary) set. You can't put any random characters in there, the operators with = exist only for some operations (+ - * / % ^ ~ $ and |)
The main application of the $-operator is to exercise the syntax checker of the compiler to prevent the accumulation of rust between the bits. It's used mostly by typing-challenged posters who were targeting the &-key but missed it wildly by 3 keys. This inaccuracy training is also a prerequisite for the job of missile guidance officer in war zones to properly execute surgical strikes with carpet bombing.
Korman:
It's used mostly by typing-challenged posters who were targeting the &-key but missed it wildly by 3 keys.
When I read that, the thought, "What keyboard is he using where the $ is anywhere near the &" popped into my head before even getting to the latter part describing how badly you missed it.