BUTTON is a single button Unit. The button status can be detected by the input pin by simply capturing the high/low electrical level. If the button is pressed, the signal level will be high if the button is released, the signal level will be low.
As shown in the figure below:
This unit communicates with M5Core through GROVE B port.
EasyLoader is a concise and fast program writer, which has a built-in case program related to the product. It can be burned to the main control by simple steps to perform a series of function verification.
The screen displays the current button status.
|M5Core(GROVE B)||Btn (GPIO36)||NC (GPIO26)||5V||GND|
|BUTTON Unit||BUTTON Pin||5V||GND|
The code below is incomplete (just for reference). To get the complete code, please click here
Detect different states of the button and perform corresponding operations
Button wasPressed Press the button to execute the set function
obtain button wasPressed Check if the button is pressed, only once during execution