Cov txheej txheem:

Yooj Yim Digital Clock Siv Arduino Nano & DS1307: 4 Cov Kauj Ruam
Yooj Yim Digital Clock Siv Arduino Nano & DS1307: 4 Cov Kauj Ruam

Video: Yooj Yim Digital Clock Siv Arduino Nano & DS1307: 4 Cov Kauj Ruam

Video: Yooj Yim Digital Clock Siv Arduino Nano & DS1307: 4 Cov Kauj Ruam
Video: Top 5 Best Digital Wall Clock 2022 2024, Kaum ib hlis
Anonim
Yooj Yim Digital Clock Siv Arduino Nano & DS1307
Yooj Yim Digital Clock Siv Arduino Nano & DS1307

Hauv kab lus no kuv yuav qhia koj kev qhia ua lub moos digital siv Arduino.. Pawg Arduino uas kuv siv yog Arduino Nano V3, DS1307 ua lub sijhawm muab cov ntaub ntawv, MAX7219 7 Segment raws li lub moos saib.

ua ntej nkag mus rau kev qhia, Kuv pom zoo kom koj paub siv Arduino cov cuab yeej thiab khoom siv ntxiv. Qhov no yuav ua kom yooj yim rau koj ua raws cov ntawv qhia uas kuv tau qhia.

Yog tias koj tsis paub siv Arduino boards, tsis txhob txhawj.

Koj tuaj yeem nyeem kab lus no kom sov:

  • Yuav Ua Li Cas Siv Arduino Nano
  • MAX7219 7-Segment Siv Arduino
  • Yuav Ua Li Cas Siv DS1307 Siv Arduino

Kauj Ruam 1: Cov Cheeb Tsam Xav Tau

Yuav tsum tau Cheebtsam
Yuav tsum tau Cheebtsam
Yuav tsum tau Cheebtsam
Yuav tsum tau Cheebtsam
Yuav tsum tau Cheebtsam
Yuav tsum tau Cheebtsam

cov no yog cov khoom peb xav tau los ua lub moos digital:

  • Arduino Nano V3
  • TSO DS1307
  • MAX7210 7Segment
  • Jumper Hlau
  • USBmini
  • Pawg Thawj Coj

Yuav tsum muaj tsev qiv ntawv:

  • Hlau
  • LedControl
  • RTClib

Kauj Ruam 2: Sib Sau Ua Ke Txhua Yam

Sib Sau Ua Ke Txhua Yam
Sib Sau Ua Ke Txhua Yam

Yog tias tag nrho cov khoom tau txais, Tam sim no nws yog lub sijhawm los sib sau ua ke.

Saib cov lus piav qhia hauv qab no lossis saib daim duab saum toj no:

Arduino rau RTC DS1307

GND => GND

+5V => VCC

A4 => SDA

A5 => SCL

Arduino rau MAX7219

+5V => VCC

GND => GND

D12 => DIN

D11 => CLK

D10 => CSJ

Tom qab tag nrho cov khoom siv raug teeb tsa, txuas ntxiv mus rau ntu ntu kev qhia.

Kauj ruam 3: Programming

luam thiab muab daim duab no tso rau hauv daim duab uas koj tau ua. Tom qab ntawd rub qhov program mus rau arduno board

#include #include "LedControl.h" #include "RTClib.h"

RTC_DS1307 rtc;

LedControl lc = LedControl (12, 11, 10, 1);

void teeb tsa () {

Serial.begin (57600); yog (! rtc.begin ()) {Serial.println ("Tsis pom RTC"); thaum (1); } yog (! rtc.isrunning ()) {Serial.println ("RTC tsis ua haujlwm!"); // kab ntawv hauv qab no teeb tsa RTC mus rau hnub tim & sijhawm no cov duab kos tau muab tso ua ke // rtc.adjust (DateTime (F (_ DATE_), F (_ TIME_)))); // Cov kab no teeb tsa RTC nrog hnub tim & sijhawm qhia meej, piv txwv li teeb tsa // Lub Ib Hlis 21, 2014 thaum 3 teev sawv ntxov koj yuav hu: // rtc.adjust (DateTime (2014, 1, 21, 3, 0, 0)); } lc.shutdown (0, tsis tseeb); lc.setIntensity (0, 8); lc.clearDisplay (0); }

void voj () {

Hnub tim tam sim no = rtc.now (); yog (now.second () 40) {lc.setDigit (0, 0, now.second ()%10, tsis tseeb); lc.setDigit (0, 1, now.second ()/10, tsis tseeb); lc.setChar (0, 2, '-', tsis tseeb); lc.setDigit (0, 3, now.minute ()%10, tsis tseeb); lc.setDigit (0, 4, now.minute ()/10, tsis tseeb); lc.setChar (0, 5, '-', tsis tseeb); lc.setDigit (0, 6, now.hour ()%10, tsis tseeb); lc.setDigit (0, 7, now.hour ()/10, tsis tseeb); }

yog (now.second () == 30 || now.second () == 40)

{lc.clearDisplay (0); }

yog (now.second ()> = 31 && now.second () <40) {lc.setDigit (0, 6, now.day ()%10, tseeb); lc.setDigit (0, 7, now.day ()/10, tsis tseeb); lc.setDigit (0, 4, now.month ()%10, tseeb); lc.setDigit (0, 5, now.month ()/10, tsis tseeb); lc.setDigit (0, 0, (tam sim no.year ()%1000)%10, tsis tseeb); lc.setDigit (0, 1, (now.year ()%1000)/10, tsis tseeb); lc.setDigit (0, 2, (tam sim no.year ()%1000)/100, tsis tseeb); lc.setDigit (0, 3, now.year ()/1000, tsis tseeb); }}

Kauj Ruam 4: Qhov tshwm sim

Tom qab txhua kauj ruam ua tiav, qhov no yog qhov tshwm sim uas koj yuav pom: (saib video)

txhua txhua 31st thib ob txog thib 40 thib ob. 7 Ntu yuav tso saib hnub tim. Tsuas yog zaum thib ob, 7 ntu yuav tso saib lub moos

Pom zoo: