Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
alienzhangyw edited this page Apr 25, 2020 · 2 revisions

Buttons are digital input devices. BlockPi support many different button to be used as input signal. I use button modules like these:

Connect the OUT pin to a GPIO port, VCC to 3.3V, GND to GND.

Test input value

You'd better test and verify the input value with this code before using the botton(or any other input device):

The botton module I use returns 1 when not pressed, 0 when pressed.

Button counter

The 'repeat until' part is jitters elimination, makes sure that one press one count.

Button-trigger LED

Single switch LED

Switches between multiple LEDs

Use list to control multiple LEDs:

It works like this: