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

EXTRA FUNCTION: Adjust LED gradient rainbow time? #7

Open
Bruur-vr opened this issue Nov 29, 2024 · 1 comment
Open

EXTRA FUNCTION: Adjust LED gradient rainbow time? #7

Bruur-vr opened this issue Nov 29, 2024 · 1 comment

Comments

@Bruur-vr
Copy link

Bruur-vr commented Nov 29, 2024

Hi,

I succesfully downloaded your firmware and made a change where the LEDs now stay on and make a rainbow pattern.
I was wondering how you would make a timer function in the macropad.c file?
I seem to be able to include time.h, but I keep getting syntax errors on using clock_t ..

             if(NeoHue == 191)
              {
              NeoHue = 0;
              }
             else 
              { 
// add clock function here so LEDS transit smoother
                NeoHue += 1;
              }
              
            for (i = 0; i < 6; i += 1) // for every neopixel
              {
                NEO_writeHue(i, NeoHue, NEO_BRIGHT_KEYS);
                NEO_update();
              }
@wagiminator
Copy link
Owner

You can use one of the timers/counters of the CH552. If precise timing is not required, I simply use a counter variable that decrements in the loop. When it reaches ZERO, the desired action is executed, and the variable is reloaded with the desired value.

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