Cov txheej txheem:

Siv 4 Tus lej & 7 Segment Display, Nrog Arduino: 7 Kauj Ruam
Siv 4 Tus lej & 7 Segment Display, Nrog Arduino: 7 Kauj Ruam

Video: Siv 4 Tus lej & 7 Segment Display, Nrog Arduino: 7 Kauj Ruam

Video: Siv 4 Tus lej & 7 Segment Display, Nrog Arduino: 7 Kauj Ruam
Video: Часть 3 - Аудиокнига Герберта Уэллса «Анна Вероника» (гл. 08–10) 2024, Kaum ib hlis
Anonim
Siv 4 Tus lej & 7 Segment Display, Nrog Arduino
Siv 4 Tus lej & 7 Segment Display, Nrog Arduino

Hauv qhov kev qhia no kuv yuav qhia koj yuav siv 7 ntu qhia nrog 4 tus lej siv arduino. Qee qhov yooj yim uas kuv xav taw qhia yog qhov no yuav luag txhua yam ntawm cov lej digital ntawm arduino uno, leonardo, cov laug cam nrog 13 tus lej digital. Cov lus qhia feem ntau muaj 12 tus pin tawg uas txuas ncaj qha mus rau arduino, lossis dhau los ntawm tus tiv thaiv. Tsis tas li, kuv xav taw qhia tias cov lus qhia no tsis xav tau hauv av, 5V, lossis 3.3V los txuas nrog. Yog li, cia peb pib…

Kauj ruam 1: Cov ntaub ntawv

Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv

Kev siv cov zaub ntawm yam no yuav tsum tsis muaj cov khoom siv.

4 x 330Ω resistors

- 12 x Txiv neej rau txiv neej jumper xov hlau

- 1 x Arduino

- 1 x khob cij ntawm txhua qhov loj me (lawv tsis xav tau lub hwj chim ntsia)

Tsis muaj cov cuab yeej xav tau txhawm rau ua tus qauv ntawm qhov tsim qauv no. Txawm li cas los xij, yuav tsum tau siv cov hlau txuas thiab lub pcb pawg thawj coj saib kom siv tau tas mus li.

Kauj ruam 2: Layout Breadboard

Breadboard Layout
Breadboard Layout

Tsuas yog muab qee cov ntsiab lus rau koj Kuv yuav piav qhia kev siv ntawm txhua tus pin. 8 tawm ntawm 12 tus pin ntawm cov zaub tau siv rau 8 ntu. Muaj 7 ntu uas siv los ua ib tus lej thaum ib tus tswj tus lej zauv. Lwm 4 tawm ntawm 12 tus pin tswj txhua tus ntawm 4 tus lej ntawm cov zaub. Txhua tus pin uas muaj tus tiv thaiv rau nws yog ib qho ntawm 4 tus lej lej, txwv tsis pub lawv yog cov ntu ntu.

Cov qauv tsim saum toj no kuv tsim los ntawm fritzing txhawm rau qhia kev sib txuas ntawm cov zaub thiab arduino. Nco ntsoov qhov kev tso kawm ntawm qhov chaw tiv thaiv vim tias yog tias koj txuas tus tiv thaiv rau tus lej tsis raug ntawm lub vijtsam, tus lej ntawd yuav tsis ua haujlwm lossis ntu ntawd yuav tsis ua haujlwm, YUAV TSUM …

*** TSEEM CEEB TSHAJ PLAWS ***

Thaum teeb tsa lub xov tooj hluav taws xob hloov cov xim daj thiab cov kab liab liab (Kuv ua rau kuv daim duab tsis sib xws).

Kauj Ruam 3: Txhim Kho Lub Tsev Qiv Ntawv

Lub tsev qiv ntawv txuas hauv qab no yog los ntawm arduino lub vev xaib kom yooj yim tswj cov zaub. Qhov txuas mus rau github. Yog tias koj tsis tau nyob ntawm github mloog kom zoo, yog tias koj tau nyeem kab lus tom ntej. Thaum koj nkag mus rau lub vev xaib saib ntawm sab xis ntawm lub qhov rais thiab saib qis kom txog thaum koj pom, "Download Zip". Nyem lub pob ntawd thiab saib nws tshwm hauv koj cov rub tawm.

Tam sim no koj yuav tsum thauj lub tsev qiv ntawv teeb tsa yav dhau los rau hauv koj lub tsev qiv ntawv tais ceev tseg. Yog tias koj tam sim no yuav ua li cas thiaj hla mus rau qib tom ntej, txwv tsis pub nyeem ntxiv. Ua ntej nkag mus rau tus nrhiav thiab nrhiav cov ntawv "cov ntaub ntawv", thiab qhib nws. Tom qab ntawd, nrhiav cov ntawv "arduino", thiab qhib nws. Tom qab ntawd, nrhiav cov ntawv tais ceev tseg, thiab qhib nws. Thaum kawg rub thiab tso lub tsev qiv ntawv teeb tsa rau hauv qhib lub tsev qiv ntawv qhib.

TSEEM CEEB. Yog tias koj daim ntawv thov arduino tau qhib thiab khiav thaum koj nyob qhov twg muab lub tsev qiv ntawv tso rau hauv lub tsev qiv ntawv tais ceev tseg, arduino yuav tsis lees paub lub tsev qiv ntawv. Koj tsuas yog yuav tsum txiav tawm daim ntawv thov thiab qhib nws dua.

github.com/DeanIsMe/SevSeg

Kauj ruam 4: Txoj Cai

Txoj Cai
Txoj Cai

Cov cai rau ua kom pom qee yam yog teev hauv qab no.

#include "SevSeg.h"

SevSeg sevseg; // Pib xya ntu ntu tswj hwm qhov tsis muaj teeb meem teeb tsa () {byte numDigits = 4; byte digitPins = {2, 3, 4, 5}; byte segmentPins = {6, 7, 8, 9, 10, 11, 12, 13}; bool resistorsOnSegments = 0; // sib txawv saum toj no qhia tias 4 tus tiv thaiv tau muab tso rau ntawm tus lej lej. // teeb tsa qhov sib txawv rau 1 yog tias koj xav siv 8 tus tiv thaiv ntawm ntu ntu. sevseg.begin (COMMON_CATHODE, numDigits, digitPins, segmentPins, resistorsOnSegments); sevseg.setBrightness (90); } void loop () {sevseg.setNumber (3141, 3); sevseg.refreshDisplay (); // Yuav tsum rov ua dua

Kauj Ruam 5: Qhov tshwm sim

Yog tias koj txuas nrog cov zaub kom raug, tau tshaj tawm cov cai kom raug, thiab theej the coded kom raug, tom qab ntawd koj cov zaub yuav tsum tso tawm pi (tsuas yog 3.141).

Yog tias tsis yog li ntawd, nyeem qib 6 rau txhua yam uas tau tshwm sim tsis raug.

Yog tias koj tau txais nws raug, tom qab ntawd kuv hais qhia kom nyeem ntxiv mus ntxiv hauv qib xya.

Kauj ruam 6: Troubleshooting

Ntawm no kuv tau teev ob yam ua tau uas tuaj yeem tshwm sim rau koj cov zaub uas tuaj yeem ua rau nws tawg. Hmoov tsis zoo tsuas yog ib ntawm ob qho tuaj yeem kho tau.

- Koj cov zaub tau tso tawm 8888

Tsis txhob txhawj xeeb qhov no yog qhov teeb meem uas tuaj yeem kho tau, tsuas yog ua raws cov theem no

1. Nrhiav qhov chaws "sevseg.begin (COMMON_CATHODE, numDigits, digitPins, segmentPins);"

2. Hloov "COMMON CATHODE" mus rau "COMMON ANODE"

3. Tshaj tawm cov cai ntxiv

- Koj cov zaub tau tso tawm 3. 41 lossis.141 lossis 3.1 1 lossis 3.14 yam tsis muaj lwm yam 1

Tu siab, qhov teeb meem no tuaj yeem kho tau lossis tsis yog:. (… (Yog kuv lub ntsej muag quaj)

1. Txheeb xyuas koj cov kev sib txuas thiab xyuas kom txhua yam yog ntsaws thiab tsis dai tawm

2. Txheeb xyuas cov txheej txheem dua, vim tias feem ntau koj yuav txuas nws tsis raug

3. Nrhiav kab hauv qhov tsis muaj qhov khoob uas nws hais kom pom (3.141, 3) thiab hloov 3.141 txog 8888 thiab saib yog tias ib qho ntawm 8 ploj lawm

4. Yog li ib qho ntawm cov xov hlau yuav tsis muaj tus tiv thaiv thaum nws yuav tsum muaj lub ntsiab lus uas ib tus lej tau hlawv tawm. Koj tuaj yeem tshawb xyuas qhov no los ntawm saib tom qab ntawm cov zaub. Yog tias koj pom ib qho dub nyob ze ntawm ib tus pins koj tau kov yeej ib qho ntawm cov lej. Tu siab qhov no TSIS YOG kho tau thiab koj yuav xav yuav lwm cov khoom.

5. Yog tias koj tsis pom lub cim dub nyob qhov twg ntau dua li koj tau hloov cov xov hlau uas tsis tuaj yeem siv zog tau yog li txheeb xyuas cov phiaj xwm thiab ntsaws tom qab kom raug thiab hloov cov cai rov qab los ntawm 8888 mus rau 3.141.

Kauj Ruam 7: Mus Ntxiv

Ib txoj hauv kev siv ob peb tus pin ntawm arduino los tswj ntau lub LEDs uas yuav tsis tas li xav tau ntau tus pin yog tri-xeev 8 tus pin hloov pauv-sau npe. Yog li tsis txhob txuas ncaj qha rau 8 ntu ntu rau arduino koj tuaj yeem ntsaws lawv rau hauv cov npe hloov pauv thiab txiav txim siab yuav ua li cas.

Nws tsuas yog lub tswv yim uas kuv tau los nrog tab sis kuv tsis paub yuav ua li cas lossis yog tias nws tseem tuaj yeem ua tau nrog arduino thiab lub tsev qiv ntawv tso saib, tab sis hav, zaub mov rau kev xav rau qhov xav paub.

Muaj kev lom zem nrog koj cov zaub thiab kuv vam tias koj nyiam cov lus qhia no vim nws yog thawj zaug uas kuv tau ua tiav ntawm ntau qhov kuv muaj hauv kuv cov ntawv sau.

Pom zoo: