Skip to content
Advertisement

Raspberry Pi – Increase Blinking Speed LED

I have two LEDs, blue and green. I want to gradually increase the blinking speed of the green LED while the blue LED is also on at the same time for 5 seconds. Here is my code so far.

JavaScript

To execute this function, this is the code

JavaScript

It somehow works but the green LED is only blinking at a constant rate. Any suggestions on how I can make the green LED blink at an increasing rate?

Advertisement

Answer

Keep the duration in a variable and decrease the duration in every loop

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement