Measuring button clicks show on RGB LEDstrip (neopixel Adafruit)

Hi, I am very new to Arduino and wanted some help with a project I am working on.

I want to make a button that measures click speed.
From the moment the button is first pressed a counter of 20 seconds will start (doesn't have to be visible but maybe after 20 seconds there could be a buzzer sound?).

Within the 20 seconds the buttonpresses will be measured. Per 10 clicks, one light on the LEDstrip will go on. 10 lights in total. (Inspo from the fair).

After the 20 seconds the total of leds will be shown on a OLED display. "You've reached 4 leds" for example.

Can somebody help me with this code?

It should include:

  • The button
  • Optional: A buzzer that will go off after 20 seconds
  • OLED Display

Your post was MOVED to its current location as it is more suitable.

What code have you got so far ?

I have got the code that counts the times the button has been pressed, but do not know how to go from here.

Save the value of millis() when the button becomes pressed. Check each time through loop() whether 20 seconds has elapsed

Count the clicks and and add an LED to the column every 10. The modulus operator ( % ) is a useful way of doing this
What type of LEDs are they. Neopixels/WS2812 would be easiest to use

  • capture timestamp on 1st button press
  • check if time expired in loop(). reset when expired
  • check for button press in loop(), count button presses
  • number of leds lit = number of button presses / 10
  • stop if number leds == 10 before time expired

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.