Cov txheej txheem:

Yuav Siv Keypad & LCD Nrog Arduino Ua Li Cas Arduino Calculator.: 5 Kauj Ruam
Yuav Siv Keypad & LCD Nrog Arduino Ua Li Cas Arduino Calculator.: 5 Kauj Ruam

Video: Yuav Siv Keypad & LCD Nrog Arduino Ua Li Cas Arduino Calculator.: 5 Kauj Ruam

Video: Yuav Siv Keypad & LCD Nrog Arduino Ua Li Cas Arduino Calculator.: 5 Kauj Ruam
Video: Qhia Hle & Hloov Màn Hình LCD Laptop | Siv Laptop Tsis Yuav LCD 2024, Hlis ntuj nqeg
Anonim
Yuav Ua Li Cas Siv Keypad & LCD Nrog Arduino Los Ua Arduino Lub Luag Haujlwm
Yuav Ua Li Cas Siv Keypad & LCD Nrog Arduino Los Ua Arduino Lub Luag Haujlwm

Hauv qhov kev qhia no kuv yuav qhia koj yuav siv 4x4 matrix keypad thiab 16x2 LCD nrog Arduino li cas thiab siv nws los ua Arduino Calculator yooj yim.

Yog li cia pib …

Kauj Ruam 1: Yam Koj Yuav Tsum Tau:-

Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau
Yam Koj Yuav Tsum Tau

Yuav Tsum Tau Kho Vajtse:-

  1. Arduino UAS.
  2. 4 x 4x keypad. (Koj tuaj yeem siv 4x3 cov keyboard).
  3. 16x2 LCD Zaub
  4. Cov qhob cij.
  5. 10 k potentiometer.
  6. qee cov xov hlau los txuas rau lub keyboard.

Yuav tsum tau Software:-

Arduino IDE Cov

Qhov ntawd yog txhua yam koj yuav xav tau rau txoj haujlwm no.

Kauj Ruam 2: Nkag Siab Cov Keypad:-

Nkag siab Cov Keypad
Nkag siab Cov Keypad
Nkag siab Cov Keypad
Nkag siab Cov Keypad

Yog li txhawm rau siv cov keypads ua ntej koj yuav tsum nkag siab tias cov keyboard ua haujlwm li cas.

Keypad tsis muaj dab tsi tab sis khawm khawm nrog nxn tus lej ntawm kab thiab kab. Cov kab yog kab rov tav thiab Kab yog ntsug.

Hauv 4x4 matrix muaj 4 Kab thiab 4 kab thiab hauv 4x3 muaj 4 Kab thiab 3 Kab.

Txhua khawm hauv kab tau txuas nrog txhua lwm cov nyees khawm hauv tib kab. Tib yam nrog kab.

Nias lub pob kaw qhov kev hloov pauv ntawm ib kab thiab kab kab, tso cai rau tam sim no ntws los ntawm Kab Tus Kab thiab Kab Tus Kab. Nov yog li cas arduino pom lub pob twg raug nias.

Kuv tsis xav dhia dej tob rau hauv nws thiab ua rau cov lus qhia tho txawv yog li yog tias koj xav kawm paub ua haujlwm ntawm cov keyboard hauv qhov tob koj tuaj yeem tshawb xyuas cov ntawv no.

Cia peb txav mus rau qib tom ntej …

Kauj Ruam 3: Kev Sib Txuas:-

Kev Sib Txuas
Kev Sib Txuas
Kev Sib Txuas
Kev Sib Txuas
Kev Sib Txuas
Kev Sib Txuas

1. Siv cov xov hlau txuas rau ntawm tus xovtooj. Solder header pins rau lwm qhov kawg.

2. Xa mus rau daim duab rau thiab ua kev sib txuas raws li hauv qab no:-

  • R1 = D2
  • R2 = D3
  • R3 = D4
  • R4 = D5
  • C1 = D6
  • C2 = D7
  • C3 = D8
  • C4 = D9

3. Kev sib txuas hauv LCD yog yooj yim ib yam nkaus.

  • Ua ntej txuas LCD ntawm lub khob cij.
  • Tam sim no txuas tus pin RW, LED cathode thiab Vss lossis GND mus rau GND txoj kev tsheb nqaj hlau.
  • Txuas Vcc mus rau +ve txoj kev tsheb nqaj hlau. Kuj txuas tus pin LED anode (Txoj cai ib sab ntawm cathode) rau +ve tsheb nqaj hlau los ntawm 220 ohm resistor.
  • Txuas qhov sib txawv tus pin sau ua V0 rau nruab nrab lub davhlau ya nyob twg ntawm lub hwj chim. Txuas lwm ob lub dav hlau ntawm lub lauj kaub rau +ve thiab GND.
  • Tam sim no txuas tus pin hauv qab no kom:
  • D4 = D13
  • D5 = D12
  • D6 = D11
  • D7 = D10

qhov twg, D2, D3,….., D13 yog Digital i/o pins ntawm arduino.

Thaum cov kev sib txuas tau ua tiav. Peb tuaj yeem txav mus rau theem coding …

Kauj ruam 4: Keypad Code:-

Keypad Txoj Cai
Keypad Txoj Cai
Keypad Txoj Cai
Keypad Txoj Cai

Ua ntej koj tuaj yeem pib coding koj yuav tsum teeb tsa lub tsev qiv ntawv rau peb cov keyboard thiab LCD. Txhawm rau rub lub tsev qiv ntawv, qhib IDE thiab nkag mus:-

  • Kev kos duab >> suav nrog lub tsev qiv ntawv >> Tswj lub tsev qiv ntawv.
  • Hauv qhov tshawb nrhiav hom "Keypad.h" thiab nqes mus nrhiav "Keypad library by Mark Stanley version 3.1.1"
  • Kuj xyuas yog tias lub tsev qiv ntawv LiquidCrystal tau teeb tsa. Yog tsis yog, koj tuaj yeem pom nws siv tib txoj kev.
  • Nruab cov tsev qiv ntawv thiab rov pib dua IDE.

Tam sim no theej cov cai hauv qab no thiab muab nws tso rau hauv IDE. Upload nws mus rau arduino. (Code rau 4x3 tuaj yeem rub tawm los ntawm hauv qab no):-

Txoj cai no yuav pab koj txheeb xyuas qhov ua haujlwm ntawm Keypad, Nws qhia lub pob nyem ntawm Serial monitor.

/*Code rau 4x4 keypad*/

#include const byte ROWS = 4; const byte COLS = 4; char keys [ROWS] [COLS] = {{'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', 'C'}, {'*', '0', '#', 'D'}}; byte rowPins [ROWS] = {5, 4, 3, 2}; byte colPins [COLS] = {9, 8, 7, 6}; Keypad keypad = Keypad (uaKeymap (tuav), rowPins, colPins, ROWS, COLS); teeb tsa tsis muaj dab tsi () {Serial.begin (9600); } void loop () {char key = keypad.getKey (); yog (qhov tseem ceeb) {Serial.println (qhov tseem ceeb); }}

Nrog rau qhov no koj tuaj yeem pib nrog cov keyboard nrog arduino, Tus lej rau lub laij lej yog nyob rau theem tom ntej..

Kauj Ruam 5: Arduino Calculator Code:-

Arduino Tshuab xam zauv Code
Arduino Tshuab xam zauv Code
Arduino Tshuab xam zauv Code
Arduino Tshuab xam zauv Code

Thaum koj tau sim cov keyboard, thiab nws ua haujlwm tau zoo. koj tuaj yeem txav mus los ua lub laij lej yooj yim.

Koj tuaj yeem rub tawm cov cai los ntawm cov ntawv hauv qab no.

Txhawm rau siv lub laij lej yooj yim upload cov cai, Cov tsiaj ntawv tau siv raws li hauv qab no:-

A = + (Ntxiv)

B = - (Rho tawm)

C = * (Sib npaug)

D = / (faib)

Cov cim * thiab # tau siv ua 'Ncua tseg' thiab 'Sib npaug rau' Raws li

Nov yog txhua yam rau qhov kev qhia no. Vam tias koj nyiam.

Ua tsaug.

Pom zoo: