Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau
- Kauj ruam 2: Kev sib txuas
- Kauj ruam 3: Code
- Kauj Ruam 4: Lub Tshuab Ntsuas Tawm
Video: Arduino DIY Calculator Siv 1602 LCD thiab 4x4 Keypad: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
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 qhov kev suav.
Kauj Ruam 1: Yam Koj Xav Tau
Rau cov lus qhia no peb yuav xav tau cov khoom hauv qab no: Arduino Uno (Txhua version yuav ua haujlwm)
16 × 2 LCD Zaub
4 × 4 Keypad9V BatteryBreadboard Txuas cov xov hlau
Kauj ruam 2: Kev sib txuas
Daim duab kab lus ua tiav ntawm qhov Arduino Calculator Project tau muab rau saum toj no. Qhov +5V thiab kev sib txuas hauv av tau qhia hauv daim duab qhia chaw tuaj yeem tau txais los ntawm 5V thiab tus pin hauv av ntawm Arduino. Arduino nws tus kheej tuaj yeem siv tau los ntawm koj lub laptop lossis los ntawm DC jack siv 12V adapter lossis 9V roj teeb. Cov Keyboard yuav muaj 8 tus pin uas yuav tsum tau txuas nrog los ntawm tus pin 0 rau tus pin 7 raws li tau hais los saum no. Qee qhov Arduino cov laug cam yuav qhia qhov ua yuam kev thaum rub tawm qhov program yog tias muaj dab tsi txuas nrog tus pin 0 thiab tus pin1, yog li yog tias koj muaj ib qho twg tsuas yog tshem tawm keypad thaum rub tawm qhov program.
Kauj ruam 3: Code
Luam cov cai hauv qab no & upload rau nws koj li arduino:/ * * Arduino Keypad lub laij lej Program */#suav nrog "LiquidCrystal.h" // Header file for LCD from https://www.arduino.cc/en/Reference/LiquidCrystal# suav nrog "Keypad.h" // Header file for Keypad los ntawm https://github.com/Chris--A/Keypadconst byte ROWS = 4; // Plaub rowconst byte COLS = 4; // Peb kab ntawv // Txhais cov Keymapchar [ROWS] [COLS] = {{'7', '8', '9', 'D'}, {'4', '5', '6', ' C '}, {' 1 ',' 2 ',' 3 ',' B '}, {'*',' 0 ','#',' A '}}; byte rowPins [ROWS] = {0, 1, 2, 3}; // Txuas cov keyboard ROW0, ROW1, ROW2 thiab ROW3 rau cov Arduino pins.byte colPins [COLS] = {4, 5, 6, 7}; // Txuas keypad COL0, COL1 thiab COL2 rau cov Arduino pins. Keypad kpd = Keypad (uaKeymap (yuam sij), rowPins, colPins, ROWS, COLS); // Tsim Keypadconst int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13; // Pins uas LCD txuas nrogLiquidCrystal lcd (rs, en, d4, d5, d6, d7); ntev Num1, Num2, Number; char qhov tseem ceeb, nqis tes ua; boolean result = cuav; teeb tsa tsis muaj dabtsis () {lcd.begin (16, 2); // Peb tab tom siv 16*2 LCD zaub lcd.print ("DIY Calculator"); // Zaub cov lus qhia lcd.setCursor (0, 1); // teeb tus cursor rau kab 0, kab 1 ncua (2000); // Tos rau cov zaub los qhia cov ntaub ntawv lcd.clear (); // Tom qab ntawd ntxuav nws} void loop () {key = kpd.getKey (); // khaws cia nias tus nqi tseem ceeb hauv tus lej (tus lej! = NO_KEY) NtesButtons (); yog (qhov tshwm sim == muaj tseeb) CalculateResult (); DisplayResult (); } void DetectButtons () {lcd.clear (); // Tom qab ntawd ntxuav nws yog (qhov tseem ceeb == '*') // Yog hais tias rho tawm khawm yog nias {Serial.println ("Khawm Nres"); Number = Num1 = Num2 = 0; tshwm sim = tsis tseeb;} yog (qhov tseem ceeb == '1') // Yog tias khawm 1 raug nias {Serial.println ("Khawm 1"); yog (Tus lej == 0) Tus lej = 1; lwm tus lej = (Tus lej*10) + 1; // Nias ob zaug} yog (qhov tseem ceeb == '4') // Yog tias khawm 4 raug nias {Serial.println ("Khawm 4"); yog (Tus lej == 0) Tus lej = 4; lwm tus lej = (Tus lej*10) + 4; // Nias ob zaug} yog (qhov tseem ceeb == '7') // Yog tias khawm 7 raug nias {Serial.println ("Khawm 7"); yog (Tus lej == 0) Tus lej = 7; lwm tus lej = (Tus lej*10) + 7; // Nias ob zaug} yog (qhov tseem ceeb == '0') {Serial.println ("Khawm 0"); // Khawm 0 yog Nias yog (Tus lej == 0) Tus lej = 0; lwm tus lej = (Tus lej*10) + 0; // Nias ob zaug} yog (qhov tseem ceeb == '2') // Nias 2 yog Nias {Serial.println ("Khawm 2"); yog (Tus lej == 0) Tus lej = 2; lwm tus lej = (Tus lej*10) + 2; // Nias ob zaug} yog (qhov tseem ceeb == '5') {Serial.println ("Khawm 5"); yog (Tus lej == 0) Tus lej = 5; lwm tus lej = (Tus lej*10) + 5; // Nias ob zaug} yog (qhov tseem ceeb == '8') {Serial.println ("Khawm 8"); yog (Tus lej == 0) Tus lej = 8; lwm tus lej = (Tus lej*10) + 8; // Nias ob zaug} yog (qhov tseem ceeb == '#') {Serial.println ("Button Equal"); Num2 = Tus lej; result = tseeb; } yog (qhov tseem ceeb == '3') {Serial.println ("Khawm 3"); yog (Tus lej == 0) Tus lej = 3; lwm tus lej = (Tus lej*10) + 3; // Nias ob zaug} yog (qhov tseem ceeb == '6') {Serial.println ("Khawm 6"); yog (Tus lej == 0) Tus lej = 6; lwm tus lej = (Tus lej*10) + 6; // Nias ob zaug} yog (qhov tseem ceeb == '9') {Serial.println ("Khawm 9"); yog (Tus lej == 0) Tus lej = 9; lwm tus lej = (Tus lej*10) + 9; // Nias ob zaug} yog (qhov tseem ceeb == 'A' || qhov tseem ceeb == 'B' || qhov tseem ceeb == 'C' || qhov tseem ceeb == 'D') // Txheeb xyuas Cov Khawm ntawm Kab 4 {Num1 = Tus lej; Zauv = 0; yog (qhov tseem ceeb == 'A') {Serial.println ("Ntxiv"); kev ua = '+';} yog (qhov tseem ceeb == 'B') {Serial.println ("Kev rho tawm"); kev ua = '-'; } yog (qhov tseem ceeb == 'C') {Serial.println ("Multiplication"); kev ua = '*';} yog (qhov tseem ceeb == 'D') {Serial.println ("Devesion"); kev ua = '/';} ncua (100); }}
void CalculateResult () {if (action == '+') Number = Num1+Num2; if (action == '-') Number = Num1-Num2; if (action == '*') Number = Num1*Num2; if (action == '/') Number = Num1/Num2; } void DisplayResult () {lcd.setCursor (0, 0); // teeb tus cursor rau kab 0, kab 1 lcd.print (Num1); lcd.print (nqis tes ua); lcd.print (Num2); yog (qhov tshwm sim == muaj tseeb) {lcd.print ("="); lcd.print (Tus lej);} // Tso saib qhov tshwm sim lcd.setCursor (0, 1); // teeb tus cursor rau kab 0, kab 1 lcd.print (Tus lej); // Tso saib qhov tshwm sim}
Kauj Ruam 4: Lub Tshuab Ntsuas Tawm
Yog li peb ua tiav kev sib txuas & Tshaj tawm cov cai rau arduino thiab nws lub sijhawm los ntsaws lub zog thiab ua qee qhov kev suav suav & raws li koj tuaj yeem pom kuv tab tom suav nrog cov keyboard thiab koj tuaj yeem pom cov txiaj ntsig hauv lcd. Yog li muaj kev lom zem ua koj tus kheej lub tshuab xam zauv diy siv arduino.
Pom zoo:
Arduino Calculator Siv 4X4 Keypad: 4 Cov Kauj Ruam (nrog Duab)
Arduino Calculator Siv 4X4 Keypad: Hauv qhov kev qhia no peb yuav tsim peb tus kheej lub laij lej nrog Arduino. Qhov muaj nuj nqis tuaj yeem xa mus los ntawm cov keyboard (4 × 4 keypad) thiab cov txiaj ntsig tuaj yeem pom ntawm lub vijtsam LCD. Lub laij lej no tuaj yeem ua haujlwm yooj yim xws li Ntxiv, Rho Tawm, Ntau Dua
Niaj hnub nimno thiab Tshiab thiab Yooj Yim Piv Txwv Ntawm Cov Xauv Nrog Arduino Matrix Keypad 4x4: 3 Cov Kauj Ruam
Niaj hnub nimno thiab Tshiab thiab Yooj Yim Piv Txwv Ntawm Lub Xauv Nrog Arduino Matrix Keypad 4x4: Lwm qhov piv txwv ntawm kev siv lub LCD keypad matrix 4x4 nrog I2C Circuit Court
Siv 1602 LCD Keypad Shield W/ Arduino [+Cov Haujlwm Tseem Ceeb]: 7 Kauj Ruam
Siv 1602 LCD Keypad Shield W/ Arduino [+Cov Haujlwm Tseem Ceeb]: Koj tuaj yeem nyeem qhov no thiab lwm yam kev qhia zoo kawg ntawm ElectroPeak lub vev xaib raug cai Saib ua ntej Hauv qhov kev qhia no, koj yuav kawm paub siv Arduino LCD keypad npog nrog 3 qhov haujlwm li cas. Koj Yuav Kawm Li Cas: Yuav teeb tsa daim thaiv thiab txheeb xyuas cov yuam sij li cas
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Yuav Siv Keypad & LCD Nrog Arduino Ua Li Cas Arduino Calculator.: 5 Kauj Ruam
Yuav Siv Keypad & LCD Nrog Arduino Ua Arduino Calculator: Hauv qhov kev qhia no kuv yuav qhia koj li cas thiaj tuaj yeem siv 4x4 matrix keypad thiab 16x2 LCD nrog Arduino thiab siv nws los ua Arduino Calculator yooj yim. Yog li cia pib