Let's see: I've already managed to reproduce what I did yesterday. Nothing spectacular...
To check that the outputs work, I connect pins 1, 9, 17, 25, ... and change the code manually. I indicate, in this piece of code, the part I change: where it says "setRegisterPin (1, HIGH)" & "setRegisterPin (1, LOW)", I substitute 1 for a 9 and relay 9, goes to LOW.
So the outputs are working with 74HC595. 9 is the value of "i" in the buble "for" when I press the switch connected to pin 9 of the 74HC165. But how do I let Arduino know that there is a 9?
Perhaps building a matrix (array) in the buble "for" that has 0 and 1 (0,1,1,1,0,0,1, ...) and then calling element 9? So I would do it in another programming language but in Arduino I do not know ... I feel strange!
...
//74HC595=====================================
if(estado000 = 1)
{
setRegisterPin(9, HIGH);
estado000 = 0;
}
else
{
setRegisterPin(9, LOW);
estado000 = 1;
}
////////////////////////
writeRegisters();
//MUST BE CALLED TO DISPLAY CHANGES
//Only call once after the values are set how you need.
...
Jobi-Wan:
Then what is your issue at the moment?If you are using the latest code you posted in reply #20, then you will always set all out outputs LOW. You never set anything to HIGH.
The problem is that when I press one of the switches I see a 1 but I do not know how to make that pulsation cause the corresponding relay to move or led to light.
I do not know how to make that pulsation (that input) have an impact on an exit.
With the code of post # 20 Arduino was arranged to read all 74HC165 and, indeed, if you press any switch, regardless of whether it is within the first 8 chips or outside, you get HIGH.
But now I have to be able to reflect that HIGH in an output, be it a relay, an LED ... the outputs work, but so far I have only been able to check it manually.