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

No red LED lights up in apa102.c example program. #446

Open
olibel270 opened this issue Dec 9, 2023 · 2 comments
Open

No red LED lights up in apa102.c example program. #446

olibel270 opened this issue Dec 9, 2023 · 2 comments

Comments

@olibel270
Copy link

When running the apa102.c example program on a LED board, the "wave" pattern works flawlessly, but the color red never lights up.

Upon further investigation of the code, I believe I found the following typo in the main function:

      for (int i = 0; i < N_LEDS; ++i) {
            put_rgb888(pio, sm,
                       wave_table[(i + t) % TABLE_SIZE],
                       wave_table[(2 * i + 3 * 2) % TABLE_SIZE],
                       wave_table[(3 * i + 4 * t) % TABLE_SIZE]
            );
        }

Should rather be:

        for (int i = 0; i < N_LEDS; ++i) {
            put_rgb888(pio, sm,
                       wave_table[(i + t) % TABLE_SIZE],
                       wave_table[(2 * i + 3 * t) % TABLE_SIZE],
                       wave_table[(3 * i + 4 * t) % TABLE_SIZE]
            );
        }

For clarity, in the second wave_table[] access, the current code uses constant 2, rather than the likely intended variable t.

Testing proves to fix the issue.

@lurch
Copy link
Contributor

lurch commented Dec 10, 2023

Testing proves to fix the issue.

Would you like to submit a PR with the fix? (against the develop branch)

@olibel270
Copy link
Author

For sure! I'll get on it.

olibel270 added a commit to olibel270/pico-examples that referenced this issue Dec 10, 2023
…le program.

Simple typo correction which makes the red LED lights turn on as expected, following the wave pattern.
olibel270 added a commit to olibel270/pico-examples that referenced this issue Dec 11, 2023
Red used to not light up. Lights up and follows the wave pattern after the typo fix.
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

2 participants