Debouncing With Buttons Help

Plss help. The Circuit has 2 buttons(from pin 3 and 4 to GND) and 1 LED(from pin 2 to GND). button1 toggles on/off while button2 blinks the LED if button1 is HIGH. I can’table to blink the LED using button2 while button1 is HIGH.

MultiButtons3_ino.ino (1.22 KB)

Here is my code

#include "ClickButton.h"

// the LED
const int ledPin = 2;
int ledState = 0;

// the Button
const int buttonPin1 = 3;
const int buttonPin2 = 4;

ClickButton button1(buttonPin1, LOW, CLICKBTN_PULLUP);
ClickButton button2(buttonPin2, LOW, CLICKBTN_PULLUP);

// Arbitrary LED function 
int LEDfunction = 0;
int LEDfunction2 = 0;
//int LEDfunction2 =
void setup()
{
  pinMode(ledPin,OUTPUT);  
  // Setup button timers (all in milliseconds / ms)
  // (These are default if not set, but changeable for convenience)
  button1.debounceTime   = 20;   // Debounce timer in ms
  button1.multiclickTime = 250;  // Time limit for multi clicks
  button1.longClickTime  = 1000; // time until "held-down clicks" register

 button2.debounceTime   = 20;   // Debounce timer in ms
 button2.multiclickTime = 250;  // Time limit for multi clicks
 button2.longClickTime  = 1000; // time until "held-down clicks" register
}

void loop()
{
  // Update button state
  button1.Update();
button2.Update();
  // Save click codes in LEDfunction, as click codes are reset at next Update()


if(button1.clicks == 1 && button2.clicks == 0) 
ledState = !ledState;

if(button1.clicks == 1 && button2.clicks == 1) 
ledState = (millis()/500)%2;

digitalWrite(ledPin,ledState);
}

The ledState is a logic variable you have assigned it a value based on the millis time. Why have you done that? You can only write 0 or 1 not a value to a digital pin.