HS-KEY4P Push Button Module

HS-KEY4P Push Button Module

1. Introduction

2. Schematic

4P Button Module - HS-KEY4P SchematicClick to view

Module Parameters

Pin Name

description

G

GND (Negative Power Input)

V

VCC (Positive Power Input)

1

Digital Signal Pin

2

Digital Signal Pin

3

Digital Signal Pin

4

Digital Signal Pin

  • Power Supply Voltage: 3.3V / 5V

  • Connection method: PH2.0 terminal wire

  • Installation method: Fixed with four screws

4, Circuit Board Size

5 of Arduino IDE example program

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Arduino IDE Library Download and Import Tutorial:
Click to view

Example program (UNO development board):

volatile int light;

void setup(){
  light = 0;
  pinMode(6, OUTPUT);
  analogWrite(6, 0);
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
}

void loop(){
  //LED็ฏๆŽฅD6ๅผ•่„š๏ผšๅ››ไฝๆŒ‰้”ฎๆจกๅ—1~4ๅˆ†ๅˆซๆŽฅๅผ€ๅ‘ๆฟA0๏ผŒA1๏ผŒA2๏ผŒA3

  if (digitalRead(A0) == 0) {
    light = 0;

  }
  if (digitalRead(A1) == 0) {
    light = 30;

  }
  if (digitalRead(A2) == 0) {
    light = 125;

  }
  if (digitalRead(A3) == 0) {
    light = 255;

  }
  analogWrite(6, light);

}

6, ESP32 Python Example (for Mixly IDE/Misashi)

Choose the development board Python ESP32 [ESP32 Generic(4MB)] and upload in code mode

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

Example program (ESP32-Python):

ๅพ…ๆ›ดๆ–ฐ...

7, Mixly example program (graphical language)

Example program (UNO development board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial of Mixly IDE Arduino library:Click to view

Example Program (ESP32 Development Board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

8. Setting up the Test Environment

Arduino UNO Test Environment Setup

Prepare Components:

  • HELLO STEM UNO R3 DEVELOPMENT BOARD *1

  • HELLO STEM UNO R3 P EXPANSION BOARD *1

  • USB TYPE-C DATA CABLE *1

  • LED module (HS-F08P) *1

  • Four-position analog key module (HS-KEY4B-P) *1

  • PH2.0 3P terminal to DuPont wire *2 or PH2.0 3P dual-head terminal wire *2

Circuit wiring diagram:

ESP32 Test Environment Setup

Prepare Components:Pending update...

Circuit wiring diagram:Pending update...

9, Video tutorial

Video tutorial:Click to view

10, Test results

Arduino UNO test results:

After the device is connected to the wire, burn the above program to the UNO-R3 PRO development board and then connect the power supply. Pressing different buttons will also change the brightness of the LED.

ESP32 Test Results:

Pending update...