Cov txheej txheem:

Pushbutton LED Matrix: 4 Cov Kauj Ruam
Pushbutton LED Matrix: 4 Cov Kauj Ruam

Video: Pushbutton LED Matrix: 4 Cov Kauj Ruam

Video: Pushbutton LED Matrix: 4 Cov Kauj Ruam
Video: Home Automation: Using 4 Push button push-ON and push-OFF 4 relays with Arduino 2024, Kaum ib hlis
Anonim
Pushbutton LED Matrix
Pushbutton LED Matrix

Txoj haujlwm no tuaj yeem xav txog ntawm lwm qhov kev qhia ua haujlwm Arduino uas tau nce qib me ntsis ntau dua li koj li 'ntsais muag LED' qhov haujlwm. Txoj haujlwm no suav nrog ib qho LED matrix, thawb lub pob, hloov npe (uas tuaj yeem txuag pins ntawm koj lub Arduino board), thiab lub ntsiab lus tseem ceeb hu ua multiplexing. Kuv vam tias koj pom cov lus qhia ua kom pom tseeb thiab twv koj tus kheej kom txhim kho nws!

Khoom siv

(1x) Arduino Uno

(5x) Tactile Pushbuttons

(2x) 0.1 uF Capacitors

(2x) 1 uF Capacitors

(8x) 1k Resistors

(5x) 10k Resistors

(2x) 74HC595 hloov npe rau npe

Jumper Hlau

Dub Hlau

Hlau liab

Kauj Ruam 1: Kauj Ruam 1: Ua LED Matrix

Kauj Ruam 1: Ua LED Matrix
Kauj Ruam 1: Ua LED Matrix
Kauj Ruam 1: Ua LED Matrix
Kauj Ruam 1: Ua LED Matrix
Kauj Ruam 1: Ua LED Matrix
Kauj Ruam 1: Ua LED Matrix

Cov ntawv qhia kuv siv los ua 8x8 LED matrix hauv txoj haujlwm no tuaj yeem pom ntawm no. Muaj ntau yam teeb tsa rau LED matrix:

a) Ntau Kab Anode

b) Ntau Kab Cathode

Txij li thaum kuv tau siv Cov Txheej Txheem Rho Cathode ntawm cov qauv, kuv yuav tham txog nws ntawm no thiab koj tuaj yeem txuas ntxiv tib cov kev xav rau Common Row Anode kev teeb tsa. Hauv Cov Txheej Txheem Rho Cathode, cov LEDs 'cathodes (lossis cov dav hlau tsis zoo uas yog luv dua ceg ntawm LED) txuas nrog ua ke hauv kab thaum lub anodes (lossis cov dav hlau zoo uas yog ceg ntev dua ntawm LED) txuas nrog ua ke hauv kab. Txhawm rau hais txog ib qho tshwj xeeb LED, rub kab cathode uas LED cathode nyob qis thiab rub kab anode uas LED anode nyob siab.

Nco tseg: Thaum ua qhov LED matrix uas tau qhia hauv qhov txuas saum toj no, nco ntsoov txuas cov kab anode nrog 1k ohm resistors ua ntej thov siv tus nqi hluav taws xob rau LEDs.

Kauj Ruam 2: Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Cov Ntawv Sau Npe

Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe
Kauj Ruam 2: Txuas Cov Pushbuttons thiab Hloov Sau Npe

Cov thaiv rau lub khawm khawm thiab cov npe hloov pauv tau qhia saum toj no. Kuv xav nco ntsoov tias kev hloov pauv rau npe hauv daim duab kab hluav taws xob tsis qhia hauv av (tus pin 8 ntawm IC) thiab Vcc lossis lub zog txuas (tus pin 16 ntawm IC) tus pin rau cov chips; hauv av tus pin txuas nrog GND tus pin ntawm Arduino board thiab Vcc txuas nrog 5V tus pin ntawm Arduino board. Vcc tus pin ntawm txhua qhov kev hloov npe tseem muaj txuas nrog rau 0.1uF capacitor txuas nrog hauv av.

Nco tseg: Cov txiaj ntsig ntawm txhua qhov kev hloov npe tau teev tseg ua QA rau QH (tsis quav ntsej QH*). Lawv tau teev nyob rau hauv nqe lus ntawm qhov tseem ceeb me ntsis (LSB) (rau QA) mus rau qhov tseem ceeb me ntsis (MSB) (rau QH) piv txwv li QA yuav tswj 0 kab lossis kab, thiab lwm yam.

Kauj Ruam 3: Kauj Ruam 3: Tshaj Tawm Txoj Cai

Txoj cai los tswj hwm LED matrix tau txuas rau qhov kev qhia no. Kuv tau sim tawm tswv yim ntau npaum li cov cai raws li kuv tuaj yeem yog li nws yuav pom meej heev tias txoj haujlwm ua haujlwm li cas. Lub hauv paus tseem ceeb ntawm txoj haujlwm yog muaj qhov sib piv uas ua raws qhov LEDs yuav tsum nyob lossis tawm. Txhawm rau kom muaj ntau yam LEDs tso saib kom raug yam tsis tau yuam kev tig rau qhov tsis xav tau diodes yog siv lub tswv yim hu ua multiplexing. Multiplexing yog qhov tseem ceeb teeb pom kev zoo ib leeg LEDs hauv kab tshwj xeeb thaum tag nrho lwm cov LEDs hauv lwm kab, tom qab ntawd ua tib yam rau cov kab uas seem. Qhov ua kom yuam kev yog tias yog LEDs hloov mus los ntawm kab nrawm txaus, koj lub qhov muag tuaj yeem qhia tias cov kab ib leeg tau teeb ib zaug. Yog tias koj xav tshawb nrhiav ntau txoj hauv kev koj tuaj yeem dag koj lub qhov muag nrog LEDs, koj yuav xav saib mus rau hauv lub tswv yim ntawm kev nyob ruaj khov ntawm lub zeem muag (yooj yim tshawb hauv Google lossis Qhia).

Txoj hauv kev kab anode thiab kab cathode tau hloov kho tshiab yog los ntawm tus neeg siv txhais lub luag haujlwm hu ua 'UpdateShiftRegisters'. Lub luag haujlwm no thawj zaug tig lub latch tus pin, uas tswj hwm yog tias ib qho tshiab byte (8 khoom) raug xa mus rau qhov tso tawm, qis yog li tsis muaj kev hloov pauv rau cov txiaj ntsig tau ua tau thaum cov khoom tshiab tau sau rau hauv nti. Tom qab ntawd siv qhov ua haujlwm hauv Arduino hu ua 'ShiftOut', uas tshwj xeeb ua haujlwm xa cov ntaub ntawv kom hloov npe, qhov kev zov me nyuam sau qhov twg (cathode) kab yuav qis thiab qhov twg (anode) kab yuav tsum siab. Thaum kawg, tus latch tus pin raug rub siab kom hloov kho cov zis (LEDs).

Kauj Ruam 4: Cov Lus Qhia Ntxiv/Cov Khoom Siv

Nov yog qee qhov txuas mus rau cov vev xaib lossis cov phau ntawv uas yuav muab cov ntaub ntawv ntxiv txog qhov haujlwm no:

learn.adafruit.com/adafruit-arduino-lesson-4-eight-leds/arduino-code

www.arduino.cc/en/tutorial/ShiftOut

www.ti.com/lit/ds/symlink/sn74hc595.pdf

www.youtube.com/watch?v=7VYxcgqPe9A

www.youtube.com/watch?v=VxMV6wGS3NY

Pib Nrog Arduino, 2nd Edition los ntawm Massimo Banzi

Pom zoo: