Cov txheej txheem:

Arduino Keypad 4x4 Tutorial: 4 Kauj Ruam (nrog Duab)
Arduino Keypad 4x4 Tutorial: 4 Kauj Ruam (nrog Duab)

Video: Arduino Keypad 4x4 Tutorial: 4 Kauj Ruam (nrog Duab)

Video: Arduino Keypad 4x4 Tutorial: 4 Kauj Ruam (nrog Duab)
Video: How to use Arduino 4x4 keypad download the code 2024, Kaum ib hlis
Anonim
Arduino Keypad 4x4 Tutorial
Arduino Keypad 4x4 Tutorial

Cov keyboard nkag tau pom rau cov saib txuas nrog arduino uno thiab 4x4 keypad tag nrho cov lej…

Khoom siv

Arduino ib x 1

4 x 4 Keypad

Txhua yam no tuaj yeem pom ntawm lub xaib no:

BDSpeedy Tech Xeem

Kauj ruam 1: Txuas nrog Arduino

Txuas nrog Arduino
Txuas nrog Arduino
Txuas nrog Arduino
Txuas nrog Arduino

Txuas cov keyboard nrog aruduino digital pins:

Keypad Pin Txuas rau Arduino Pin

1d9 ua

2d8 ua

3d7 ua

4d6 ua

5d5 ua

6d4 ua

7d3 ua

8d2 ua

Kauj ruam 2: Code

Code
Code

CODE:

#suav nrog

const byte numRows = 4

const byte numCols = 4;

keymap [numRows] [numCols] = {{'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', 'C'}, {'*', '0', '#', 'D'}};

byte rowPins [numRows] = {9, 8, 7, 6}; // Kab 0 rau 3

byte colPins [numCols] = {5, 4, 3, 2}; // Kab 0 rau 3

// pib qhov piv txwv ntawm chav kawm Keypad

Keypad myKeypad = Keypad (uaKeymap (keymap), rowPins, colPins, numRows, numCols);

void teeb tsa () {

Serial.begin (9600);

}

// Yog tus yuam sij raug nias, tus yuam sij no tau muab khaws cia rau hauv 'keypressed' hloov pauv // Yog tus yuam sij tsis sib npaug rau 'NO_KEY', ces tus yuam sij no tau luam tawm // yog suav = 17, tom qab ntawd suav tau rov pib dua rau 0 (qhov no txhais tau tias tsis muaj tus yuam sij raug nias thaum tag nrho cov txheej txheem luam theej duab

void voj () {

char keypressed = myKeypad.getKey ();

yog (keypressed! = NO_KEY)

{

Serial.print (nias);

}

}

Kauj ruam 3:

ntawm no yog kuv qhov blogspot txuas nws muaj qee daim duab ntxiv uas koj yuav pom muaj txiaj ntsig… blogspot txuas

Kauj Ruam 4: Ntxiv Tsev Qiv Ntawv

Ntxiv Tsev Qiv Ntawv
Ntxiv Tsev Qiv Ntawv
Ntxiv Tsev Qiv Ntawv
Ntxiv Tsev Qiv Ntawv
Ntxiv Tsev Qiv Ntawv
Ntxiv Tsev Qiv Ntawv

Ntxiv tsev qiv ntawv:

Txhawm rau ntxiv lub tsev qiv ntawv mus rau Skeetches> suav nrog lub tsev qiv ntawv ntaus lub npe tsis ncaj ncees "keypad" tom qab ntawv nyem rau nruab.

wordpress blog

Blog chaw

Pom zoo: