button

buttonIntroductionQuick StartUsing FPIOA Function

 

Introduction

In this section, we will learn how to use the user buttons on the K230 module.

image-20250401143756809

① This button is a custom button that we can use. This tutorial will introduce how to read the status of this button.

② This button is the reset (RST) button. After pressing it, K230 will restart.

Quick Start

For ease of use, we encapsulate the key function in the ybUtils.YbKey library.

Copy the following code into CanMV IDE and run it [Source Code/02.Basic/04.key.py]

After running this code, we can try to press the custom button ① on K230 and observe that the serial terminal will output a prompt when we press it.

Be careful not to press the RST button. The button near the USB cable end is the RST reset button.

image-20250401145701651

Using FPIOA Function

Below is the original code of the YbKey module

We use GPIO61 as the pin for button detection