Getting Started
Starter Kit
Controller Board
Electronic Module

1.Product Introduction

../../_images/4-Button-1.png

The 4-button module contains four presses, and the circuit is on when a button is pressed and disconnected when it is released. Because the four key switches share one analog output, they can only be connected to the analog port. Each key corresponds to an analog value, so as to realize the discrimination of different keys.

Application reference: remote control, keyboard, game controller, etc.

2.Parameter Specification

Parameter Value//Description
Operating voltage 3.3V~5V
Operating temperature -40°C~+80°C
Output signal Analog signal
Size 4.7cm*2.4cm
../../_images/4-Button-2.png

3.Wiring Diagram

Hint

Expansion board is attached to esp32 controller board.

../../_images/4-Button-3.png
4-Button Module ESP32
S 32
VCC 5V
GND GND

4.Sample Code

 1int n = 0;
 2
 3void setup(){
 4  Serial.begin(115200);//Set baud rate
 5}
 6
 7void loop(){
 8  n = analogRead(32);//Define the analog pin for the 4-Button
 9  //Print different button values
10  if(n<10){
11    Serial.println("Right: "+String(n));
12    }
13  else if(n>10 && n<=1000){
14    Serial.println("Down: "+String(n));
15    }
16  else if(n>1000 && n<=3000){
17    Serial.println("Left: "+String(n));
18    }
19  else if(n>3000 && n<=4000){
20    Serial.println("Up: "+String(n));
21    }
22  delay(300);
23}

5.Test Result

When you successfully connect the line according to the wiring diagram and successfully upload the correct program, when a certain button is pressed, the serial port monitor will print the corresponding button value.

../../_images/4-Button-4.png
../../_images/4-Button-5.png

6.Related Resources

7.Get One Now

B2B Business: info@acebott.com

© Copyright ACEBOTT All Rights Reserved.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.