Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Control the Pins with the 74HC595 Shift Register? #113

Closed
SphaeroX opened this issue Feb 12, 2024 · 1 comment
Closed

How to Control the Pins with the 74HC595 Shift Register? #113

SphaeroX opened this issue Feb 12, 2024 · 1 comment

Comments

@SphaeroX
Copy link

SphaeroX commented Feb 12, 2024

Helllo i buyed the MKS TinyBee for an Project and now im not able to Set the Output of some pins.

Here is what im try to do:

// IOExpander.h
#ifndef IO_EXPANDER_H
#define IO_EXPANDER_H

#define DATA_PIN 25
#define LATCH_PIN 26
#define CLOCK_PIN 27

void setupIOExpander()
{
    pinMode(DATA_PIN, OUTPUT);
    pinMode(LATCH_PIN, OUTPUT);
    pinMode(CLOCK_PIN, OUTPUT);
}

void test()
{
    byte patternHigh = 0b11111111;
    byte patternLow = 0b00000000;

    Serial.println("HIGH");
    digitalWrite(LATCH_PIN, LOW);
    for (int i = 0; i < 3; i++)
    {
        shiftOut(DATA_PIN, CLOCK_PIN, LSBFIRST, patternHigh);
    }
    digitalWrite(LATCH_PIN, HIGH);

    delay(1000);

    Serial.println("LOW");
    digitalWrite(LATCH_PIN, LOW);
    for (int i = 0; i < 3; i++)
    {
        shiftOut(DATA_PIN, CLOCK_PIN, LSBFIRST, patternLow);
    }
    digitalWrite(LATCH_PIN, HIGH);
}

#endif

but all signals are still low, what im doing wrong?

@SphaeroX SphaeroX changed the title How to Control the Pins? How to Control the Pins with the 74HC595 Shift Register? Feb 13, 2024
@SphaeroX
Copy link
Author

I don't know why but know it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant