Hi Everyone,
In order to move a project from a Mega2560 to a Nano 33 IoT I've set up a SN74HC595N.
I've connected Qa to Qh on the relay pins and put a 104 nF capacitor on VCC and GND after reading this thread about de-coupling, although I'm not 100% I have the right capacitor.
The 595 is powered from an external 5V and as far as I can tell I've done eveything right. (examples work as intented)
I've used these guides on how it works:
Guide to ShiftOut
595 Adruino tutorial
595 and Arduino full guide
ESP32 with 595 and relay modules
more pins with 595
And a bunch of topics with various applications. There was an example by sending a 0b00001000 bit to the shiftOut function directly to operate a single relay, but from what i understand this means all the others are off. Making an array of 255 possible combinations doesnt sound like a good idea.
All the examples work just fine after being uploaded, but I'm not looking for the LEDs on the relay module to show me a pretty pattern. I want to operate individual relays, and do so while the state of the other relays remains unchanged, as I did when the relay module was connected to my mega, with lots of pins.
leds = 0; // Initially turns all the LEDs off, by giving the variable 'leds' the value 0
updateShiftRegister();
delay(500);
for (int i = 0; i < 8; i++) // Turn all the LEDs ON one by one.
{
bitSet(leds, i); // Set the bit that controls that LED in the variable 'leds'
updateShiftRegister();
delay(500);
}
This is great and all but I'm looking for a way to be able to use a direct value corresponding to a certain relay, and use that instead of "i"
To summarize: I don't fully understand what commands to send to the 595 to control it properly. ![]()
