Cov txheej txheem:

ELECTRONIC DICE Siv CLOUDX M633: 5 Cov Kauj Ruam
ELECTRONIC DICE Siv CLOUDX M633: 5 Cov Kauj Ruam

Video: ELECTRONIC DICE Siv CLOUDX M633: 5 Cov Kauj Ruam

Video: ELECTRONIC DICE Siv CLOUDX M633: 5 Cov Kauj Ruam
Video: Ib lo lus Remix Dj - Super zab _ Mob lub siab ua luaj no - Nkauj tshiab 2023 2024, Hlis ntuj nqeg
Anonim
ELECTRONIC DICE Siv CLOUDX M633
ELECTRONIC DICE Siv CLOUDX M633

Peb txhua tus yuav tsum tau ua si qhov kev sib tw hauv ib txoj kev lossis lwm qhov siv cov tsuav. Paub txog qhov xwm txheej tsis paub tseeb ntawm qhov dov ntawm cov tsuav yuav tig los nthuav tawm ntxiv ntxiv kev lom zem ntau dua.

Kuv nyob ntawm no, nthuav qhia cov khoom siv hluav taws xob digital siv cov LEDs yooj yim, lub laub khawm thiab CloudX M633 module los siv nws.

Kauj ruam 1: QHOV TSEEB

QHOV TSEEB
QHOV TSEEB
QHOV TSEEB
QHOV TSEEB
QHOV TSEEB
QHOV TSEEB
  • CloudX M633
  • CloudX softcard
  • Leds
  • Resistors (100r, 10k)
  • BreadBoard
  • Jumper hlau
  • laub-khawm
  • V3 cev

Kauj ruam 2: LEDS

LEDS
LEDS

Lub teeb emitting diodes (LEDs) yog hom tshwj xeeb ntawm diodes uas ci thaum tam sim no dhau los ntawm lawv. Tsuas yog qhov kev saib xyuas zoo tshaj plaws tau txwv tus nqi tam sim no uas tau dhau los ntawm lawv txhawm rau txhawm rau zam kom tsis txhob ua rau lawv puas tsuaj.

Kauj Ruam 3: Sib cuam tshuam cov LEDs nrog CloudX M633

Kev cuam tshuam cov LEDs nrog CloudX M633
Kev cuam tshuam cov LEDs nrog CloudX M633

Tag nrho cov Circuit Court yog ua los ntawm ob ntu: microcontroller thiab LED ntu feem. Cov LEDs tau teeb tsa hauv ob pawg nrog txhua - (suav nrog 7 LEDs), sawv cev rau lub ntsej muag ib txwm ntawm tsuav; thiab txuas nrog tus pin P1 dhau mus rau tus pin P14 ntawm MCU module.

Kev ua haujlwm tag nrho tig ncig lub microcontroller module ua lub plawv dhia ntawm tag nrho txoj haujlwm. Nws (MCU) tuaj yeem ua haujlwm ntawm:

  • tog twg los ntawm VIN thiab GND cov ntsiab lus (piv txwv li txuas lawv mus rau koj lub zog hluav taws xob sab nraud-chav tsev +ve thiab –ve cov dav sib xws) ntawm pawg thawj coj saib;
  • lossis dhau ntawm koj li CloudX USB softcard module.

Raws li tau piav qhia meej hauv daim duab qhia saum toj no, LEDs tau teeb tsa nyob rau hauv ib txoj hauv kev uas thaum lawv taws teeb, lawv qhia tus lej raws li lawv xav tau hauv qhov tseeb. Thiab peb tab tom ua haujlwm nrog ob pawg LEDs los sawv cev rau ob daim tsuav sib cais. Txhua tus ntawm lawv tau txuas nrog hauv hom kev lim dej tam sim no.

Thawj pawg ntawm LEDs suav nrog: D1, D2, D3, D4, D5, D6, thiab D7; tau txuas nrog MCU tus pin: P1, P2, P3, P4, P5, P6, thiab P7 feem ntawm 10Ω resistors. Whereas lwm pab pawg suav nrog: D8, D9, D10, D11, D12, D13, thiab D14; tau txuas nrog MCU tus pin: P9, P10, P11, P12, P13, P14, thiab P15 feem ntawm 10Ω resistors ib yam.

Tom qab ntawd, lub laub-khawm hloov SW1 ith nrog uas peb ua tus lej tsis sib xws los ntawm kev hloov xovxwm, txuas nrog MCU tus pin P16 siv rub tawm ntawm 10kΩ.

Kauj Ruam 4: Cov Ntsiab Cai ntawm Kev Ua Haujlwm

Thaum pib, LEDs ib txwm tawm tag los qhia tias lub kaw lus tau npaj rau tus lej tsis raug tshiab los tsim rau zaub. Ntawm kev hloov xovxwm, tus lej sib xws ntawm 1 thiab 6 yog li tsim tawm thiab nthuav tawm ntawm LEDs; thiab nyob twj ywm Nyob tos thaum lwm qhov hloov pauv-nias rov ua dua.

Kauj ruam 5: CODING

#suav nrog

#suav nrog

#define hloov 1 tus pin 16

#define nias LOW

/ *tuav cov qauv tsuav kom tso tawm ntawm LEDs */

unsigned char tuag = {0, 0x08, 0x14, 0x1C, 0x55, 0x5D, 0x77};

tsis kos npe char, dice1, dice2;

teeb tsa () {// teeb tsa ntawm no / *teeb tsa chaw nres nkoj pins raws li tso tawm * /portMode (1, OUTPUT); portMode (2, 0b10000000); / *hloov tag nrho cov LED tawm ntawm qhov pib */ portWrite (1, LOW); portWrite (2, QAB); randNumLimit (1, 6); // saib xyuas ntawm randomNumber tiam ntau (piv txwv li min, max)

rov () {

// Qhov program ntawm no yog (switch1 raug nias) {thaum (switch1 yog LOW); // tos ntawm no kom txog thaum hloov pauv tso dice1 = randNumGen (); // tsim tus lej tsis raug rau dice1 dice2 = randNumGen (); portWrite (1, tuag [dice1]); // nqa cov qauv tsuav kom raug thiab qhia nws portWrite (2, tuag [dice2]); } lwm {portWrite (1, tuag [dice1]); portWrite (2, tuag [dice2]); }}} // Qhov kawg ntawm Txoj Haujlwm

Pom zoo: