Cov txheej txheem:

Ib tus Pin 4 × 4 Keypad: 10 Kauj Ruam
Ib tus Pin 4 × 4 Keypad: 10 Kauj Ruam

Video: Ib tus Pin 4 × 4 Keypad: 10 Kauj Ruam

Video: Ib tus Pin 4 × 4 Keypad: 10 Kauj Ruam
Video: Григ – В пещере горного короля (Grieg – In the Hall of the Mountain King) 2024, Kaum ib hlis
Anonim
Ib tus Pin 4 × 4 Keypad
Ib tus Pin 4 × 4 Keypad

Txhua lub sijhawm kuv pom cov keyboard, nws los nrog ntau tus pin, nws yog qhov pov tseg loj ntawm koj tus pin Arduino, yog li peb puas tuaj yeem siv lub keyboard nrog ib tus thiab tsuas yog ib tus pin?. Cov lus teb nyob ntawm no.

Kauj Ruam 1: Nqi Khoom

Nqi Khoom
Nqi Khoom

Kho vajtse:

01 Arduino UAS

02 Cov ntawv qhia zaub mov

01 LCD nrog I2C

16 Laub khawm

04 tus tiv thaiv 1.5 kΩ

04 resistors 620 Ω

04 resistors 220 Ω

08 resistors 100 Ω

01 tus tiv thaiv 1 kΩ

07 Jumper xov

Software:

Arduino IDE teeb tsa ntawm koj lub PC

Kauj ruam 2: Schematic thiab Cicruit

Schematic thiab Cicruit
Schematic thiab Cicruit
Schematic thiab Cicruit
Schematic thiab Cicruit

Txhua lub tswv yim yog tias peb muaj 4*4 matrix ntawm thawb khawm txuas mus rau hauv av los ntawm txoj cai txhuas thiab kab rov tav los ntawm lwm cov hlau lead (khawm coj) thiab resistors ntawm 1.5 kΩ, 620Ω, 220Ω, thiab 100Ω, qhov kawg ntawm 4 kab sib txuas los ntawm plaub 100Ω resistors raws li qhia hauv kab lus.

Txhua lub sijhawm koj thawb lub pob koj kaw lub Circuit Court thiab tam sim no dhau los ntawm txoj kev sib txawv thiab cov saw sib txawv ntawm cov resistors uas yog vim li cas tus pin A0 tau txais qhov sib txawv nyeem rau txhua lub laub khawm. Txhua yam koj xav tau tam sim no yog codding.

Kauj Ruam 3: Txoj Cai

#suav nrog

#suav nrog

LiquidCrystal_I2C lcd (0x3f, 20, 4);

int Khawm = A0;

koj readvalue;

void teeb tsa ()

{

Serial.begin (9600);

lcd.begin ();

pinMode (Khawm, INPUT);

lcd.backlight ();

lcd.print ("Nyob Zoo Ntiaj Teb");

ncua (2000);

lcd.clear ();

lcd.print ("Ib tus lej 4*4 tus lej");

ncua (2000); }

void lub voj ()

{

readvalue = analogRead (Khawm);

Serial.println (nyeem tau tus nqi);

yog (readvalue == 852) {lcd.clear (); lcd.print ("A");}

lwm {yog (readvalue == 763) {lcd.clear (); lcd.print ("B");}

lwm tus {yog (readvalue == 685) {lcd.clear (); lcd.print ("C");}

lwm tus {yog (readvalue == 965) {lcd.clear (); lcd.print ("D");}

lwm tus {yog (readvalue == 565) {lcd.clear (); lcd.print ("9");}

lwm {yog (readvalue == 614) {lcd.clear (); lcd.print ("6");}

lwm {yog (readvalue == 360) {lcd.clear (); lcd.print ("3");}

lwm {yog (readvalue == 335) {lcd.clear (); lcd.print ("#");}

lwm tus {yog (readvalue == 396) {lcd.clear (); lcd.print ("8");}

lwm tus {yog (readvalue == 349) {lcd.clear (); lcd.print ("5");}

lwm {{yog (tus nqi == 235) {lcd.clear (); lcd.print ("2");}

lwm {yog (readvalue == 279) {lcd.clear (); lcd.print ("0");}

lwm {yog (readvalue == 452) {lcd.clear (); lcd.print ("7");}

lwm {yog (readvalue == 271) {lcd.clear (); lcd.print ("4");}

lwm {yog (readvalue == 170) {lcd.clear (); lcd.print ("1");}

lwm tus {yog (readvalue == 92) {lcd.clear (); lcd.print ("*");} lwm yam {}}}}}}}}}}}}}}}}}}

Kauj Ruam 4: Kho Tus Nqi

Kho qhov muaj nuj nqis
Kho qhov muaj nuj nqis

Thaum koj qhib tus saib xyuas lub luag haujlwm nws yuav qhia tus nqi ntawm 1023, yog tias koj thawb lub pob nws yuav muab lwm qhov kev nyeem rau koj koj yuav tsum coj cov txiaj ntsig ntawd thiab ua qee qhov hloov pauv hauv txoj cai

Kauj Ruam 5: Txoj Haujlwm Tom Qab Kev Ntsuam Xyuas thiab Txheeb Xyuas

Txoj Haujlwm Tom Qab Kev Ntsuam Xyuas thiab Tshuaj Xyuas
Txoj Haujlwm Tom Qab Kev Ntsuam Xyuas thiab Tshuaj Xyuas

Tsis muaj qhov tsis ntseeg tias peb txhua tus nyob ntawm no kom kawm thiab qhia peb cov kev paub, ua tsaug rau qee cov lus tawm los ntawm qee tus neeg los ntawm zej zog uas tau pab tau zoo, Kuv txiav txim siab los ua qee qhov kev hloov kho thiab txhim kho rau kuv qhov project:

Kho vajtse:

Kuv txiav txim siab ua kom tag nrho cov khoom siv hauv PCB kom tsis txhob muaj teeb meem kev sib txuas tsis zoo hauv lub khob cij.

Cov cai:

Ib tus phooj ywg qhia kuv kom siv software debouncing thiab nws tsuas yog lub voj ("rau" lub voj piv txwv) los ua qhov haujlwm siv qee lub sijhawm los xaiv qhov nyeem nws txhais tau tias nws nyeem ntau (500 hauv kuv qhov kev xeem) tab sis siv tsuas yog zaum kawg.

rau (kuv = 1; kuv <= 500; kuv ++) {// coj tsuas yog 500th analogread

tus nqi = analogRead (Khawm);} // uas yog pab kom siv qee lub sijhawm kom tsis txhob nyeem tsis zoo

Lwm tus phooj ywg ua tsaug rau nws qhia kuv los sib piv "readvalue" nrog ntau qhov txiaj ntsig tsis yog ib qho vim "readvalue" siv ntau qhov txiaj ntsig rau tib lub laub khawm. Qhov "A" piv txwv muab nyeem ntawm: 849, 850, 851 852, 853, 854, 855 yog li nws yog qhov ntau ntawm 7 qhov tseem ceeb: qhov pib (852) thiab 3 qhov tseem ceeb sab laug thiab sab xis. yam peb yuav tsum ua ntawm no yog los sib piv qhov tsis sib xws ntawm qhov sib txawv ntawm "readvalue" thiab "852" rau "3".

yog (abs (readvalue-852) <= 8) {lcd.clear (); lcd.print ("A");}

Kauj Ruam 6: Tom Qab Qee Qhov Muag Ua Haujlwm

Tom qab Qee Qhov Muag Ua Haujlwm
Tom qab Qee Qhov Muag Ua Haujlwm
Tom qab Qee Qhov Muag Ua Haujlwm
Tom qab Qee Qhov Muag Ua Haujlwm
Tom qab Qee Qhov Muag Ua Haujlwm
Tom qab Qee Qhov Muag Ua Haujlwm

Kauj Ruam 7: Lub Sijhawm Ntawm Qhov Tseeb

Raws li koj tuaj yeem pom qhov haujlwm qee zaum cuam tshuam cov nyees khawm tab sis nws tseem ua haujlwm, hauv kev xav ther tsis muaj qhov tsis raug nrog lub Circuit Court tab sis cov cai xav tau kev ntsuas ntau dua.

Kauj Ruam 8: Qhov Kawg

Kuv vam tias koj nyiam txoj haujlwm no thiab koj sim ua nws, tej zaum koj yuav ua tau zoo dua li kuv tau ua.

Nug kuv yog tias koj muaj lus nug, tawm tswv yim thiab, tsis txhob hnov qab pov npav rau kuv yog tias koj nyiam qhov ntawd.

Pom zoo: