Red, Green light using WS2812

Hello All,

I am newbie for Arduino.

I would like to make a red, green light with arduino, two push buttons and WS2812.

Light up *WS2812 is very easy.
But when I want to use two push buttons to control WS2812,
problem comes out.

If I want to use first push button to turn on 0-23 leds to red light.
Then, press another push button to turn off 0-23 leds and turn on 24-47 leds to green night as same time.

How could I do?

Thanks!!

But when I want to use two push buttons to control WS2812,
problem comes out.

And that problem is?

How could I do?

Connect one leg of each switch to ground. Connect the other leg to a digital pin. Use INPUT_PULLUP as the pin mode.

When you read the pin, LOW means pressed, while HIGH means not pressed.

Use the state change detection example to do something only when the switch becomes pressed or becomes released.