Mundarija:

Atrofdagi real vaqtda soat: 4 qadam
Atrofdagi real vaqtda soat: 4 qadam

Video: Atrofdagi real vaqtda soat: 4 qadam

Video: Atrofdagi real vaqtda soat: 4 qadam
Video: ЛАНАТИ ЖИН БОСГАН ДАЧА 2024, Noyabr
Anonim
Atrofdagi real vaqt soati
Atrofdagi real vaqt soati

Maqsad

Men bu soatni qildim, chunki menda LED tasmasi bor va men uni ishlatmoqchiman. Keyin ko'rdimki, mening xonamda devorlariga mos keladigan yaxshi soat yo'q. Shunday qilib, men foydalanuvchilarning kayfiyatiga yoki devor rangiga qarab ranglarini o'zgartiradigan soat yasashga qaror qildim.

1 -qadam: YouTube video

Image
Image

To'liq ko'rsatmalar uchun bu youtube videosini ko'ring

2 -qadam: protsedura

Men birinchi navbatda 24 x 15 dyuymli kontrplak taxtasini oldim.

LED tasmasini bo'laklarga bo'lib kesib, taxtaga yopishtiring, keyin lehimlangandan so'ng, men hamma narsani qora qog'ozli qog'oz bilan yopaman, ustiga termokoal varaqni yopishtiraman va termokalni to'rtta etti segmentli displey shaklidagi o'tkir pichoq bilan kesib olaman. markazida ikkita teshik. Keyin quyida keltirilgan sxemalar yordamida mening sxemamni tayyorladim

va bularning hammasini taxtaning orqasiga yopishtirdi. Men ham xuddi shunday shaxsiy kompyuterga buyurtma berdim https://jlcpcb.com saytidan, ular Xitoydan eng past narxda eng yaxshi PCB prototiplarini taqdim etishadi va butun dunyo bo'ylab tez va xavfsiz etkazib berishadi. taxtaga barcha komponentlarimni lehimlagandan so'ng, men taxtani olib tashladim va hamma narsani taxtaning orqasida va old qismini yopiq shaffof qog'ozli qog'oz yordamida tuzatdim. Soat ajoyib ko'rinadi va devorning chiroyini oshiradi. Ranglarni sozlash har qanday devorga mos keladi.

Agar sizga bu loyiha yoqsa, youtube -ga obuna bo'ling yoki https://robocircuits.com veb -saytimizga tashrif buyuring, o'qiganingiz uchun tashakkur!

3 -qadam: kod

/* Kodeks RoboCircuits tomonidan ishlab chiqilgan

* Ushbu kod bo'yicha yordam olish uchun https://robocircuits.com veb -saytimizga tashrif buyuring * Bu kod DS3231.h kutubxonasidan foydalanadi, uni https://robocircuits.com saytidan yuklab oling * Videoni to'liq o'qish uchun YouTube kanalimizda https:// youtube da ko'ring. com/robocircuits */

#qo'shing #qo'shing

int i = 0, j = 0, k = 150;

// DS3231 rtc (SDA, SCL) apparat interfeysi yordamida DS3231 -ni ishga tushiring;

#ifdef _AVR_ ##endifni qo'shing

// Arduino -dagi qaysi pin NeoPixel -ga ulangan? // Trinket yoki Gemma -da biz buni 1 ta aniqlangan PIN 6 ga o'zgartirishni taklif qilamiz

// Arduino -ga nechta NeoPixel biriktirilgan? #NUMPIXELS 45 ni aniqlang

// NeoPixel kutubxonasini o'rnatganimizda, biz unga qancha piksel va signal yuborish uchun qaysi pinni ishlatish kerakligini aytamiz. // E'tibor bering, eski NeoPixel chiziqlar uchun uchinchi parametrni o'zgartirish kerak bo'lishi mumkin-mumkin bo'lgan qiymatlar haqida qo'shimcha ma'lumot olish uchun strandtest // misolini ko'ring. Adafruit_NeoPixel piksellari = Adafruit_NeoPixel (NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int kechikish vaqti = 500; // yarim soniya kechiktirish

void setup () {// Bu Trinket 5V 16MHz uchun, agar siz Trinket #if (_AVR_ATtiny85_) dan foydalanmasangiz, bu uchta qatorni olib tashlashingiz mumkin, agar (F_CPU == 16000000) clock_prescale_set (clock_div_1); #endif // Trinketning maxsus kodining oxiri

piksel.begin (); // Bu NeoPixel kutubxonasini ishga tushiradi. // Serial.begin (115200) ketma -ket ulanishni sozlash; // rtc ob'ektini ishga tushiring rtc.begin (); // Sana va vaqtni belgilash uchun quyidagi satrlarga izoh berilmasligi mumkin //rtc.setDOW(WEDNESDAY); // Haftaning kunini yakshanba kuniga belgilang //rtc.setTime(12, 0, 0); // Vaqtni 12:00:00 ga o'rnating (24 soatlik format) //rtc.setDate(1, 1, 2014); // Sanani 2014 yil 1 yanvarga belgilang}

void loop () {if (digitalRead (2) == HIGH) {int a = analogRead (A0); int b = analogRead (A1); int c = analogRead (A2); i = xarita (a, 0, 1025, 0, 150); // Yashil rang j = xarita (b, 0, 1025, 0, 150); // Moviy rang k = xarita (c, 0, 1025, 0, 150); // Qizil rang} boshqa {i = 0; j = 0; k = 150; }

// Orqa yorug'lik uchun kod (int x = 29; x <= 45; x ++) {piksel.setPixelColor (x, piksel. Color (i, j, k)); piksel.show (); }

// rtc String x = rtc.getTimeStr () dan real vaqtni olish; // Serial.println (rtc.getTimeStr ()) vaqtini yuborish; int hour1 = x.charAt (0); int hour2 = x.charAt (1); int min1 = x.charAt (3); int min2 = x.charAt (4); soat1 = soat1-48; soat2 = soat2-48; min1 = min1-48; min2 = min2-48;

// Soat tugmachasida vaqtni ko'rsatish (hour1) {// 0 holat: nol (0); // tanaffus; 1 -holat: bitta (0); tanaffus; 2 -holat: ikkita (0); tanaffus; standart: nulll (0); tanaffus; } switch (hour2) {0 holat: nol (7); tanaffus; 1 -holat: bitta (7); tanaffus; 2 -holat: ikkita (7); tanaffus; 3 -holat: uchta (7); tanaffus; ish 4: to'rt (7); tanaffus; ish 5: besh (7); tanaffus; ish 6: olti (7); tanaffus; ish 7: etti (7); tanaffus; ish 8: sakkiz (7); tanaffus; ish 9: to'qqiz (7); tanaffus; standart: nulll (7); tanaffus; } switch (min1) {0 holat: nol (15); tanaffus; 1 -holat: bitta (15); tanaffus; 2 -holat: ikkita (15); tanaffus; 3 -holat: uchta (15); tanaffus; ish 4: to'rt (15); tanaffus; ish 5: besh (15); tanaffus; standart: nulll (15); tanaffus; } switch (min2) {holat 0: nol (22); tanaffus; 1 -holat: bitta (22); tanaffus; 2 -holat: ikkita (22); tanaffus; 3 -holat: uchta (22); tanaffus; ish 4: to'rt (22); tanaffus; ish 5: besh (22); tanaffus; ish 6: olti (22); tanaffus; ish 7: etti (22); tanaffus; ish 8: sakkiz (22); tanaffus; ish 9: to'qqiz (22); tanaffus; standart: nulll (22); tanaffus; } piksel.setPixelColor (14, piksel. Color (i, j, k)); piksel.show (); kechikish (250); piksel.setPixelColor (14, piksel. Color (0, 0, 0)); piksel.show (); kechikish (250); }

bo'sh nol (int a) {piksel.setPixelColor (a+0, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } void one (int a) {piksel.setPixelColor (a+0, piksellar. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } void two (int a) {piksel.setPixelColor (a+0, piksellar. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (0, 0, 0)); piksel.show (); } bekor uchta (int a) {piksel.setPixelColor (a+0, piksellar. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } to'rtta bo'sh joy (int a) {piksel.setPixelColor (a+0, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } bo'sh besh (int a) {piksel.setPixelColor (a+0, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } void olti (int a) {piksel.setPixelColor (a+0, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } yettita bo'sh joy (int a) {piksel.setPixelColor (a+0, piksellar. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } void sakkiz (int a) {piksel.setPixelColor (a+0, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+5, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } void to'qqiz (int a) {piksel.setPixelColor (a+0, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksellar. Color (i, j, k)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (i, j, k)); piksel.show (); } void nulll (int a) {piksel.setPixelColor (a+0, piksellar. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+1, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+2, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+3, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+4, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+5, piksel. Color (0, 0, 0)); piksel.show (); piksel.setPixelColor (a+6, piksel. Color (0, 0, 0)); piksel.show (); }

4 -qadam: Rahmat

robocircuits.com saytiga tashrif buyuring

Tavsiya: