74HC595 Integration with Daisy seed, need help!

I’ve been trying without luck to make use of the sr_595.h class in libDaisy, but I cannot make the shift register work, I’m using a 74HC595.

Anyway, it seems that it doesn’t work, I’m looking for hopefully an example usage of this class, these are the excerpts of what I’m doing in the main class:

main

dsy_gpio_pin pin_cfg[] = {
        hw.GetPin(4),
        hw.GetPin(8),
        hw.GetPin(5)
    };
 
    shr.Init(pin_cfg, 1);

    shr.Set(0, true);
    shr.Write();

And a snippet of the hardware connections:

Maybe I’m missing something simple, I’m not sure though what it could be, there seems to be quite a confusion about how to address Pins on the Daisy, looking for some light, thanks :slight_smile:

Hey Pedro!

I’m sorry for the delay in response. I unfortunately don’t have 74HC595 at hand, so I was hoping somebody who has one was gonna respond.

I’m sure you saw this past forum post, but just in case, here it is: GPIO outputs and 74HC595 Serial Latch by example, beginners guide
Were you able to get this example running?

We also have an active Discord where people are asking and answering each other’s hardware questions :slight_smile:
Please feel free to join and ask about 595 on the ‘hardware’ channel.

Thanks @Takumi_Ogata , meanwhile of course my mistake, I’ve ended up using the class without any problem, I will share here how to use in case anyone else comes looking for it :slight_smile:

Init:

// to use pin abbreviations like "D1" please include:
using namespace daisy::seed;

// D1 is your latching PIN, output will happen whenever this pin is high
// D2 is your clock PIN when active it moves your data into the shift register
// D3 is you DATA pin

dsy_gpio_pin pin_cfg[] = {D1, D2, D3};
shr.Init(pin_cfg);

The issue for me was actually coming to understand that the Write function of the class does both Latching and Writing, so all you have to do to output on your main loop for example is:

shr.Set(0, 1); // Outputs high for the first output
shr.Set(1, 0); // Outputs low/null for the second output

// Commit/Update:
shr.Write();

Hope this helps the next one :slight_smile:

1 Like