Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Schematics
- Kauj Ruam 2: Txhim Kho Tsev Qiv Ntawv:
- Kauj ruam 3: Source Code:
- Kauj ruam 4: Ua haujlwm:
Video: Arduino Calculator Siv 4X4 Keypad: 4 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Hauv qhov kev qhia no peb yuav tsim peb tus kheej lub laij lej nrog Arduino. Qhov tseem ceeb tuaj yeem xa mus los ntawm cov keyboard (4 × 4 keypad) thiab cov txiaj ntsig tuaj yeem pom ntawm lub vijtsam LCD. Lub tshuab xam zauv no tuaj yeem ua haujlwm yooj yim xws li Ntxiv, Rho Tawm, Muab Zais Tawm thiab faib ua lej. Tab sis thaum koj nkag siab lub tswv yim koj tuaj yeem siv txawm tias ua haujlwm zoo nrog Arduino qhov ua haujlwm.
Khoom siv
Arduino Ib
16 × 2 LCD Zaub
4 × 4 Keypad
Cov qhob cij
Jumper Cables
Arduino Kab
Kauj ruam 1: Schematics
Kauj Ruam 2: Txhim Kho Tsev Qiv Ntawv:
Raws li tau hais ua ntej peb tab tom cuam tshuam lub LCD thiab cov keyboard nrog Arduino siv cov tsev qiv ntawv. Yog li cia peb ntxiv lawv rau peb Arduino IDE ua ntej. Lub tsev qiv ntawv rau LCD twb tau suav nrog hauv koj Arduino los ntawm lub neej ntawd yog li peb tsis tas txhawj txog nws. Rau Keypad lub tsev qiv ntawv (nyem rau ntawm qhov txuas mus rub nws los ntawm Github). Koj yuav tau txais ZIP cov ntaub ntawv, tom qab ntawv ntxiv qhov lib no rau Arduino los ntawm Sketch -> Xws li Lub Tsev Qiv Ntawv -> Ntxiv. ZIP cov ntaub ntawv thiab taw qhia qhov chaw nyob rau cov ntawv rub tawm no. Thaum ua tiav peb txhua tus tau teeb tsa rau lub cajmeem.
Kauj ruam 3: Source Code:
/*
© Techtronic Harsh
*/
#suav nrog
#suav nrog
LiquidCrystal lcd (0, 1, 2, 3, 4, 5);
const byte ROWS = 4; const byte COLS = 4;
tus yuam sij [ROWS] [COLS] = {
{'1', '2', '3', '+'}, {'4', '5', '6', '-'}, {'7', '8', '9', ' *'}, {' C ',' 0 ',' = ','/'}}; byte rowPins [ROWS] = {13, 12, 11, 10}; byte colPins [COLS] = {9, 8, 7, 6};
Keypad myKeypad = Keypad (uaKeymap (tuav), rowPins, colPins, ROWS, COLS);
boolean presentValue = tsis tseeb;
boolean tom ntej = tsis tseeb; boolean kawg = cuav; String num 1, num2; koj teb; char kev;
void teeb tsa ()
{lcd.begin (16, 2); lcd.setCursor (0, 0); lcd.print ("Techtronic Harsh"); lcd.setCursor (0, 1); lcd.print ("Tshuab xam zauv"); ncua (3000); lcd.clear (); lcd.setCursor (0, 0); lcd.print ("Zoo Li Thiab"); lcd.setCursor (0, 1); lcd.print ("Sau Npe Peb"); ncua (3000); lcd.clear (); }
void voj () {
char tseem ceeb = myKeypad.getKey ();
if (key! = NO_KEY && (key == '1' || key == '2' || key == '3' || key == '4' || key == '5' || key = = '6' || qhov tseem ceeb == '7' || qhov tseem ceeb == '8' || qhov tseem ceeb == '9' || qhov tseem ceeb == '0'))
{yog (presentValue! = tseeb) {num1 = num1 + qhov tseem ceeb; int numLength = num1.length (); lcd.setCursor (15 - numLength, 0); // txhawm rau kho ib qho chaw dawb rau tus neeg siv lcd.print (num1); } lwm {num2 = num2 + qhov tseem ceeb; int numLength = num2.length (); lcd.setCursor (15 - numLength, 1); lcd.print (num2); kawg = muaj tseeb; }}
lwm tus yog (presentValue == tsis tseeb && qhov tseem ceeb! = NO_KEY && (qhov tseem ceeb == '/' || qhov tseem ceeb == '*' || qhov tseem ceeb == '-' || qhov tseem ceeb == '+'))
{yog (presentValue == tsis tseeb) {presentValue = muaj tseeb; op = qhov tseem ceeb; lcd.setCursor (15, 0); lcd.print (op); }}
lwm tus yog (qhov kawg == tseeb && qhov tseem ceeb! = NO_KEY && qhov tseem ceeb == '=') {
yog (op == ' +') {teb = num1.toInt () + num2.toInt (); } lwm tus yog (op == ' -') {teb = num1.toInt () - num2.toInt (); } lwm tus yog (op == ' *') {teb = num1.toInt () * num2.toInt (); } lwm tus yog (op == ' /') {teb = num1.toInt () / num2.toInt (); } lcd.clear (); lcd.setCursor (15, 0); lcd.autoscroll (); lcd.print (teb); lcd.noAutoscroll (); } lwm yog (qhov tseem ceeb! = NO_KEY && qhov tseem ceeb == 'C') {lcd.clear (); presentValue = tsis tseeb; kawg = tsis tseeb; num1 = ""; num2 = ""; teb = 0; ua = ''; }}
/*
© Techtronic Harsh
*/
Kauj ruam 4: Ua haujlwm:
Ua cov kev sib txuas raws li daim duab qhia chaw thiab xa cov cai. Yog tias nws qhia qhov ua yuam kev kom ntseeg tau tias koj tau ntxiv lub tsev qiv ntawv raws li cov lus qhia tau hais los saum no.
Cim ntawm Keypad thiab Assumption:
- "A" - Ntxiv (+)
- "B" - Kev rho tawm (-)
- "C" - Sib npaug (*)
- "D" - Division (/)
- "*" - Ntshiab (C)
- "#" - Sib npaug (=)
Pom zoo:
Arduino DIY Calculator Siv 1602 LCD thiab 4x4 Keypad: 4 Kauj Ruam
Arduino DIY Calculator Siv 1602 LCD thiab 4x4 Keypad: Nyob zoo cov neeg hauv phau ntawv qhia no peb yuav ua lub laij lej siv Arduino uas tuaj yeem ua cov lej yooj yim. Yog li ntawd peb yuav siv cov tswv yim los ntawm 4x4 cov keyboard thiab luam tawm cov ntaub ntawv ntawm 16x2 lcd zaub thiab arduino yuav ua cov lej
Txawb Xov Tooj Siv Yooj Yim Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: 14 Cov Kauj Ruam (nrog Duab)
Kev Siv Xov Tooj Ntawm Lub Xov Tooj Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: Koj puas tau xav tsim qhov kev ua kom txias txias? Yog tias yog, ua li cas txog kev tsim ib qho ntawm cov neeg nyiam tshaj plaws thiab txhua tus nyiam cov khoom siv xws li Lub Xov Tooj Txawb !!!. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav tsim lub xov tooj txawb yooj yim siv STM li cas
4x4 Keypad Nrog Arduino thiab Ua: 4 Cov Kauj Ruam (nrog Duab)
4x4 Keypad Nrog Arduino thiab Ua Haujlwm: Tsis nyiam LCD cov lus? Xav ua kom koj cov phiaj xwm saib zoo li cas? Hauv Cov Lus Qhia no koj yuav tuaj yeem tso koj tus kheej los ntawm qhov teeb meem ntawm kev siv lub vijtsam LCD los tso saib cov ntsiab lus los ntawm koj li Arduino thiab tseem ua rau koj txoj haujlwm
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Cov Neeg Siv Khoom Hloov: 8 Cov Kauj Ruam (nrog Duab)
Kev Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Kev Siv Hluav Taws Xob: Lub Arduino tuaj yeem siv los tswj cov cuab yeej los ntawm kev siv cov khoom siv yooj yim hloov pauv hloov chaw