Cov txheej txheem:

Arduino 7 Segment (5011BS, Common Anode or Cathode) Tutorial: 13 Kauj Ruam
Arduino 7 Segment (5011BS, Common Anode or Cathode) Tutorial: 13 Kauj Ruam

Video: Arduino 7 Segment (5011BS, Common Anode or Cathode) Tutorial: 13 Kauj Ruam

Video: Arduino 7 Segment (5011BS, Common Anode or Cathode) Tutorial: 13 Kauj Ruam
Video: Arduino 7 Segment (5011BS, Common Anode or Cathode) Instructables Video 2024, Kaum ib hlis
Anonim
Image
Image
Txuas Tus Sucker
Txuas Tus Sucker

Peb yuav ua qhov no ua haujlwm! Hom cathode lossis Anode.

Kauj ruam 1: Txuas Tus Sucker

Kauj Ruam 2: Txuas Pins 3 & 8 rau Lub Hwj Chim (hom Anode) lossis Hauv av (hom Cathode)

Txuas Pins 3 & 8 mus rau Lub Hwj Chim (hom Anode) lossis Hauv av (hom Cathode)
Txuas Pins 3 & 8 mus rau Lub Hwj Chim (hom Anode) lossis Hauv av (hom Cathode)
Txuas Pins 3 & 8 mus rau Lub Hwj Chim (hom Anode) lossis hauv av (hom Cathode)
Txuas Pins 3 & 8 mus rau Lub Hwj Chim (hom Anode) lossis hauv av (hom Cathode)

Siv 330 tus tiv thaiv, 1k ua rau lub teeb ci dhau. Quaj 'lub zog' hauv cov leeg ntawm Clarkson thaum ua tiav cov theem no. (Tseem ceeb)

Pins 3 thiab 8 yog cov pins nruab nrab sab saum toj thiab hauv qab.

Kauj Ruam 3: Nyem Arduino rau Calibration

Nyem rau Arduino rau Calibration
Nyem rau Arduino rau Calibration

Rub tawm Xya Segment tsev qiv ntawv thiab nruab rau Arduino IDE.

github.com/DeanIsMe/SevSeg/archive/master….

Txhawm rau nruab nws, qhib Arduino IDE, mus rau Sketch> suav nrog Tsev qiv ntawv> Ntxiv. ZIP Library, tom qab ntawd xaiv SevSeg ZIP cov ntaub ntawv uas koj rub tawm.

Tam sim no peb yuav tsum nyem Arduino los sau tus lej 8 nrog tus lej kom peb tuaj yeem txuas nws tau.

chaws:

#include "SevSeg.h" SevSeg sevseg;

void teeb tsa () {

byte numDigits = 1; // peb tab tom siv cov lej ib zaug tso saib byte digitPins = {}; // tawm qhov khoob rau ib tus lej tso saib byte segmentPins = {1, 2, 3, 4, 5, 6, 7, 8}; // xaiv ib qho 8 tus pin bool resistorsOnSegments = muaj tseeb; byte hardwareConfig = COMMON_ANODE; sevseg.begin (hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments); }

void voj () {

sevseg.setNumber (8, 0); // Luam 8, 0 txhais tau tias Tus lej zauv yog siv, 1 tig nws tawm. sevseg.refreshDisplay (); // Yuav tsum txuas ntxiv ua tus lej}

Kauj ruam 4: Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)

Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)
Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)
Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)
Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)
Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)
Tam sim no Cia Peb Pib Calibrating. (Ntu A, Arduino Pin 1, LED Pin 7)

Tam sim no, peb yuav ntsuas los ntawm A-DC raws li, ib ntawm ib qho.

Saib cov cai no, nws yog tus tsiaj ntawv los ntawm A-DC.

Peb tab tom qhia rau Arduino tias:

pin 1 = A, pin 2 = B, pin 3 = C

pin 8 = DC

Yog li tam sim no, txuas ntu A rau tus pin 1. (tus pin 7 ntawm LED)

byte segmentPins = {1, 2, 3, 4, 5, 6, 7, 8}; // xaiv ib qho 8 tus pin

Kauj Ruam 5: Txuas ntu B (Arduino Pin 2, LED Pin 6)

Txuas ntu B (Arduino Pin 2, LED Pin 6)
Txuas ntu B (Arduino Pin 2, LED Pin 6)

Kauj Ruam 6: Txuas ntu C (Arduino Pin 3, LED Pin 4)

Txuas ntu C (Arduino Pin 3, LED Pin 4)
Txuas ntu C (Arduino Pin 3, LED Pin 4)

Kauj Ruam 7: Txuas ntu D (Arduino Pin 4, LED Pin 2)

Txuas ntu D (Arduino Pin 4, LED Pin 2)
Txuas ntu D (Arduino Pin 4, LED Pin 2)

Kauj Ruam 8: Txuas ntu E (Arduino Pin 5, LED Pin 1)

Txuas ntu E (Arduino Pin 5, LED Pin 1)
Txuas ntu E (Arduino Pin 5, LED Pin 1)

Kauj Ruam 9: Txuas ntu F (Arduino Pin 6, LED Pin 9)

Txuas ntu F (Arduino Pin 6, LED Pin 9)
Txuas ntu F (Arduino Pin 6, LED Pin 9)

Kauj Ruam 10: Txuas ntu G (Arduino Pin 7, LED Pin 10)

Txuas ntu G (Arduino Pin 7, LED Pin 10)
Txuas ntu G (Arduino Pin 7, LED Pin 10)

Kauj Ruam 11: Txuas ntu DC (Arduino Pin 8, LED Pin 5)

Txuas ntu DC (Arduino Pin 8, LED Pin 5)
Txuas ntu DC (Arduino Pin 8, LED Pin 5)

Kauj Ruam 12: Tidy Up thiab Hais, 'kev huv yog nyob tom ntej ntawm Vajtswv' thiab luag ntxhi vim tias koj li 8 zoo li ntxim nyiam li Heck

Tidy Up thiab Hais, 'kev huv yog nyob tom ntej ntawm Vajtswv' thiab luag nyav vim tias koj li 8 zoo li ntxim nyiam li Heck
Tidy Up thiab Hais, 'kev huv yog nyob tom ntej ntawm Vajtswv' thiab luag nyav vim tias koj li 8 zoo li ntxim nyiam li Heck

Kauj Ruam 13: Ua Tus Txheeb Ze los Qhia Tawm Koj Cov Txuj Ci Txuj Ci

Ua Tus Txheeb Xyuas los Qhia Tawm Koj Cov Txuj Ci Txuj Ci
Ua Tus Txheeb Xyuas los Qhia Tawm Koj Cov Txuj Ci Txuj Ci

Luam & muab tshuaj txhuam zoo li nws kub, peb tsuas yog tweaking lub voj loj.

void loop () {rau (int i = 0; i <10; i ++) {sevseg.setNumber (i, 0); sevseg.refreshDisplay (); // Yuav tsum txuas ntxiv ua kom pom tus lej ncua (1000); }}

Pom zoo: