Cov txheej txheem:

0-9 Segment Counter With CloudX Microcontroller: 3 Kauj Ruam
0-9 Segment Counter With CloudX Microcontroller: 3 Kauj Ruam

Video: 0-9 Segment Counter With CloudX Microcontroller: 3 Kauj Ruam

Video: 0-9 Segment Counter With CloudX Microcontroller: 3 Kauj Ruam
Video: Arduino 7-Segment counter 0-9 with push button up and down 2024, Kaum ib hlis
Anonim
0-9 Segment Counter Nrog CloudX Microcontroller
0-9 Segment Counter Nrog CloudX Microcontroller

Hauv qhov haujlwm no peb siv xya-ntu ntu LED suav los ntawm 0 txog 9.

Ib ntu xya-ntu LED suav nrog yim LEDs thiab nws yog qhov zoo tshaj rau tso saib tus lej. Ua kom txo tus lej pins siv los ntawm cov zaub, txhua qhov anodes lossis cathodes ntawm LEDs tau txuas ua ke thiab hu ua common-anode lossis common- cathode, feem. Rau peb tes num peb siv hom cathode ntau. Lub 8 LEDs tau sau lo lus A rau G thiab DP (rau tus lej cim zauv). Rau peb cov qauv cathode ntau, muaj tus pin anode rau txhua ntu LED. Piv txwv li, yog tias koj xav qhia tus lej 4, tom qab ntawd koj yuav siv tam sim no rau ntu B, C, F thiab G. CloudX Segment Library ua rau siv 7 ntu ntu yooj yim dua.

Kauj Ruam 1: Sau Cov Cheeb Tsam no

Sau Cov Cheeb Tsam no
Sau Cov Cheeb Tsam no
Sau Cov Cheeb Tsam no
Sau Cov Cheeb Tsam no
Sau Cov Cheeb Tsam no
Sau Cov Cheeb Tsam no

1. CLOUDX MICROCONTROLLER

2. CLOUDX SOFTCARD

3. V3 USB CORD

4. 7 SEGMENT (cathode)

5. JUMPER WIRE

6. 330ohm resistor

Kauj ruam 2: HARDWARE SET-UP

HARDWARE teeb tsa
HARDWARE teeb tsa
HARDWARE teeb tsa
HARDWARE teeb tsa

Ua raws cov kauj ruam no:

txuas rau:

Pin A ntawm ntu rau pin1 ntawm CloudX

Pin B ntawm ntu rau pin2 ntawm CloudX

Pin DP ntawm ntu rau pin3 ntawm CloudX

Pin C ntawm ntu rau pin4 ntawm CloudX

Pin D ntawm ntu rau pin5 ntawm CloudX

Pin E ntawm ntu rau pin6 ntawm CloudX

Pin F ntawm ntu rau pin7 ntawm CloudX

Pin G ntawm ntu rau pin9 ntawm CloudX

txuas cov cathode tus pin rau GND

Tom qab kev sib txuas, cia mus rau qhov coding:

download Cloudx IDE ntawm no

Kauj ruam 3: CODING

Luam cov cai no rau CloudX IDE

#ncig #ncig char NumberOfDigit = 1; // teeb tus lej ntawm 7 ntu qhia siv

// txuas cov CloudX pins rau Cov Ntaub Ntawv Pins A, B, C, D, E, F, G thiab H pins ntawm Zaub

char segmentDataPins = {1, 2, 3, 4, 5, 6, 7, 8};

// txuas cov CloudX pins mus rau Common Anode lossis Cathode ntawm txhua 7-ntu tso saib

char segmentScanPins = 0; // kom txuag pins peb txuas ncaj qha rau hauv av (cathode) teeb tsa () {// teeb tsa ntawm no // pib 7 ntu Qhia nrog cov ntaub ntawv Segment_setting (CCathode, NumberOfDigit, segmentScanPins, segmentDataPins); loop () {// Qhov program no Segment_write (0, 1000); // sau 0 ntawm 7-ntu zaub rau 1 sec Segment_write (1, 1000); // sau 1 ntawm 7-ntu zaub rau 1 sec Segment_write (2, 1000); // sau 2 ntawm 7-ntu zaub rau 1 sec Segment_write (3, 1000); // sau 3 ntawm 7-ntu zaub rau 1 sec Segment_write (4, 1000); // sau 4 ntawm 7-ntu zaub rau 1 sec Segment_write (5, 1000); // sau 5 ntawm 7-ntu zaub rau 1 sec Segment_write (6, 1000); // sau 6 ntawm 7-ntu zaub rau 1 sec Segment_write (7, 1000); // sau 7 ntawm 7-ntu zaub rau 1 sec Segment_write (8, 1000); // sau 8 ntawm 7-ntu zaub rau 1 sec Segment_write (9, 1000); // sau 9 ntawm 7-ntu zaub rau 1 sec}}

Pom zoo: