Skip to main content

sugar_44keytouchkeyboard

Sugar - 4*4 Touch Keyboard

Features


Signal:Time domain signal - analog serial port protoco

Module Principle

There is capacitance between any two conductive objects. The size of the capacitance is related to the conductive properties of the dielectric, the size and conductive properties of the plates, and the presence of conductive materials around the plates. The two exposed copper areas between PCB boards (or FPC) are the two plates of the capacitor, which is equivalent to a capacitor. When a human finger approaches the PCB, the capacitance changes due to the conductivity of the human body. When the touch key chip detects a significant increase in capacitance, it outputs a switch signal.

Used in FutureLite Board

Wiring

Future Board Lite Motherboard 3 - 副本.png

Future Board Lite InterfaceCable
Sugar Cube 4x4 Touch Keypad Module (2).pngSugar LED ModuleUART0Black PH2.0-4Pin Interface Cableuntitled.108.png

Supports connecting to UART0, UART1

Pay attention to keeping the interface consistent with the actual interface when programming

Blocks-Function Description

Serial NumberBlock ImageBlock Function
1blocksPng-1710142810878Initialize touch keyboard
2blocksPng-1710142817490Read pressed key value

Program 1-Complete program

Cyclically read the keys pressed by the touch, and display the key values on the dot matrix of the color screen.

Note: The type of the value of the key position read by the program is a string, which cannot be compared with a number

blocksPng-1710142968221

Program 2-Complete Program

Implement complete password lock function, enter password in order, finally press # to end, compare with set password, if successful, display screen as green blocksPng-1710143987083

Program 2 - Function Description

Program initialization: Set the color screen mode, the initial touch keyboard port

blocksPng-1710143992693

Before entering the password, the password and x variables need to be cleared to ensure that there is no data blocksPng-1710144001152

  • Read the keys in real time. When a key is pressed, add the current password bit to the main password string
  • And display the currently entered password
  • Wait for the key to be released, then enter the next password bit
  • All password bits will be output until the # key is pressed. There is no limit on the number of password bits here blocksPng-1710144011797

Compare the entered password with the set password, and display green if the input is correct Note: The set password needs to be added with #

blocksPng-1710144015868

Using Kittenblock

How to run your program using offline download to check the effect

Using on Microbit

Robotbit_压缩后.png

Programming platform

Microsoft MakeCode for micro:bit

Use Makecode programming platform

Add the Sugar Cube Plugin

image-20240311154521941 image.png

Search for "Sugar" in the extensions, click "Add"

Circuit Connection

image.png

Future Board Lite interfaceUse cable
Sugar cube 4x4 touch keyboard module (2).pngSugar cube LED moduleUARTBlack PH2.0-4Pin interface cableuntitled.108.png

Support connecting to P2 and P12,Pay attention to interface consistency with the actual interface during programming

Example 1: Read the button and display

image-20240311154946301

Case 2: Processing judgment based on key values

image-20240311155057824