it works perfect ! i m testing it and studing better the theory to understand your function and use it properly, because when i wrote the #1 i just knew that arduino send eight times a 0 or a 1 to control the shift register, no more (at least it is correct, no?)
i have been playing with this, changing the value of bytes, for the last hour
byte bitsToSend = B01000000;
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);
digitalWrite(latchPin, HIGH);
it is strange (i mean for me it is strange but maybe not for you, i started with electronic not so much weeks ago) because in "byte" without the B before even if i write only 0/1 i don t have a binary number but a normal one, why this? i lost 10 minutes to understand it and i realized it only thanks to Serial.println(bitsToSend, BIN)
so until now i understood that with the bitWrite i create the binary value to send, even if i am not completely sure how it works. in the reference it is not explained in a wonderful way
to decide which led to turn on i have to use a 1 but starting counting from the righ and after it (on the left) it is not important to write all the 0 to reach the total eight numbers
but is this 595 that works from the right or if i use LSBFIRST it will work anyway?
i still not sure about the funcion of the latchPin, i think that i understood that it is something that store the value that i send to it and don t let me change it, correct?
for example the second writing won't work
byte bitsToSend = B1;
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);
digitalWrite(latchPin, HIGH);
Serial.println(bitsToSend, BIN);
delay(1000);
bitsToSend = B10;
// digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);
digitalWrite(latchPin, HIGH);
Serial.println(bitsToSend, BIN);
delay(1000);
and the clock? it is to like sincronize the two boards? but what does it do really? it send +5, if yes when?
and i also don t understand this kind of notation: 0x01 ox37
would you mind to say me if i wrote something not correct? i know that i wrote a lot ahahah but i discovered this only today