constexpr int modulo = 1 << ledsCount;
class Button {
private:
int pin;
public:
// Constructor
Button(int _pin) {
pin = _pin;
}
bool isDown() {
return !digitalRead(pin);
}
};
// Create the instance with name "button" and call the constructor
Button button(button1_pin);
// Use it
if (button.isDown()) {
}
displayNumber();
displayNumber(counter);
How much would you need to change your code?