Cov txheej txheem:

Teeb Koj Lub Valentine Nrog Sparkling Matrix: 5 Kauj Ruam
Teeb Koj Lub Valentine Nrog Sparkling Matrix: 5 Kauj Ruam

Video: Teeb Koj Lub Valentine Nrog Sparkling Matrix: 5 Kauj Ruam

Video: Teeb Koj Lub Valentine Nrog Sparkling Matrix: 5 Kauj Ruam
Video: Красивая история о настоящей любви! Мелодрама НЕЛЮБОВЬ (Домашний). 2024, Kaum ib hlis
Anonim
Teeb Koj Lub Valentine Nrog Sparkling Matrix
Teeb Koj Lub Valentine Nrog Sparkling Matrix

Hnub Valentine yog lub sijhawm rau koj xa cov lus hlub. Vim li cas ho tsis ua lub ntsej muag lom zem LED nrog cov khoom pheej yig los qhia koj qhov kev xav!

Kauj Ruam 1: Yam Khoom Siv Hauv Txoj Haujlwm no

Cov khoom siv kho vajtse

  • Seeeduino V4.2
  • Lub hauv paus ntaub thaiv npog
  • Grove - Liab LED Matrix w/Tsav Tsheb
  • Grove - Gesture (PAJ7620U2)

Software apps thiab cov kev pabcuam online

Arduino IDE Cov

Kauj ruam 2: Zaj dab neeg

Image
Image

Kauj Ruam 3: Kev Kho Vajtse Txuas

Duab
Duab

Hauv txoj haujlwm no, peb siv lub ntsej muag ntsuas lub ntsej muag ua lub tswv yim thiab muab cov lus tawm tswv yim rau tus tsav tsheb LED matrix los pub lub teeb liab LED.

Koj yuav tsum txuas Grove - Gesture thiab Grove - Red LED Matrix w/Driver mus rau I^2^C chaw nres nkoj ntawm lub hauv paus ntaub thaiv npog uas tau txuas rau Seeeduino. Tom qab ntawd txuas Seeeduino rau PC ntawm USB cable.

Kauj ruam 4: Software Programming

Cov phiaj xwm rau txoj haujlwm no yog los tso saib lub ntsej muag zoo li qub (quaj lub ntsej muag thiab tos lub ntsej muag) thaum tsis muaj sab laug lossis sab xis piav tes piav tes tau nyeem.

Zais qhov muag-txoj haujlwm-hloov emoji nrog tswj los ntawm sab laug lossis sab xis thaum muaj sab laug lossis sab xis piav tes piav tes.

Duab
Duab

Ntawm qhov chaw tshwj xeeb ntawm lub qhov muag, lub plawv dhia yuav tshwm ntawm LED matrix.

Duab
Duab

Cov qauv duab LED tau tsim los ntawm LED Matrix Editor, koj tuaj yeem hloov lossis ntxiv koj cov qauv LED hauv cov haujlwm qhia saum toj no.

Txhawm rau npaj rau txoj haujlwm no, nws yuav tsum tau teeb tsa Grove - Gesture, Grove - Red LED Matrix w/Driver thiab MsTimer2 cov tsev qiv ntawv rau hauv Arduino IDE.

#suav nrog "Grove_LED_Matrix_Driver_HT16K33.h"

#include "MsTimer2.h" #include "paj7620.h" #suav nrog "Wire.h"

Thaum lub sijhawm txheej txheem teeb tsa, peb tau pib ua haujlwm Serial, matrix thiab MsTimer2. Initialized Serial yog siv los txhawm rau kho qhov haujlwm, yog li nws tsis tsim nyog txuas rau PC lossis siv Serial Monitor tom qab debugging. Peb siv MsTimer2 hauv txoj haujlwm no los tswj cov duab ntawm emoji zoo li qub.

// Initialized serial rau debug.

Serial.begin (9600); thaum (! Serial); paj 7620Init (); Hlau.begin (); matrix.init (); matrix.setBrightness (15); matrix.setBlinkRate (BLINK_OFF); MsTimer2:: teeb tsa (1000, displayStatic); MsTimer2:: pib ();

Hauv lub voj tseem ceeb, peb tsuas yog siv ob qhov kev tso tawm los ntawm lub ntsej muag lub ntsej muag, GES_RIGHT_FLAG, GES_LEFT_FLAG thiab cov no yog siv los coj lub displayDynamic () muaj nuj nqi.

DisplayDynamic () kev ua haujlwm yuav suav lub sijhawm txij lub sijhawm dhau los hloov pauv emoji tau tshwm sim rau lub sijhawm tam sim no, yog tias lub sijhawm ntau dua li TIMEOUT, nws yuav tso tseg ua si zoo li qub emoji, thiab teeb tsa cov cim ntsuas pom lub zog kom pib. Thaum nyeem ntawv piav tes taw mus rau sab xis, pib qhov ntsuas yog 0, thiab qhov ntsuas yuav nce ntxiv tom qab laug-rau-sab xis piav tes piav tes nyeem dua. Txwv tsis pub, qhov pib ntsuas yog qhov ntsuas kawg ntawm DYNAMIC array, thiab qhov ntsuas yuav raug txo qis.

void displayDynamic (bool leftToRight) {

unsigned ntev currentTime = millis (); yog (currentTime - prevTime> TIMEOUT) {dIndex = leftToRight? 0: ARRAY_LENGTH (DYNAMIC) - 1; showStatic = tsis tseeb; } // Qhov no yog siv los zam dhau qhov ciam teb. yog (dIndex> = ARRAY_LENGTH (DYNAMIC) || dIndex <= -1) {heartBeat (); dIndex = leftToRight? ARRAY_LENGTH (DYNAMIC) - 1: 0; } prevTime = tam sim no lub sijhawm; matrixDisplay = DYNAMIC [leftToRight? dIndex ++: dIndex--]; }

Tsis tau piav tes piav tes nyeem yog lub sijhawm TIMEOUT tau dhau mus, emoji zoo li qub ua si yuav rov qab los.

Rub tawm qhov program rau koj Seeeduino, txhua yam ua tiav. Ua si thiab muaj kev lom zem!

Kauj ruam 5: Code

#suav nrog "Grove_LED_Matrix_Driver_HT16K33.h"

#include "MsTimer2.h" #include "paj7620.h" #include "Wire.h" #define TIMEOUT 5000 #define GES_REG_ADDR 0x43 #define ARRAY_LENGTH (array) (sizeof (array) / sizeof (array [0])) Matrix_8x8 matrix; uint64_t matrixDisplay = 0; unsigned ntev prevTime = millis (); int8_t sIndex = 0; bool showStatic = tseeb; const uint64_t STATIC = {0x00003c0000a54200, 0x00003c000000e700, 0x00003c004242e700}; int8_t dIndex = 0; const uint64_t DYNAMIC = {0x00003c000021e700, 0x00003c000042e700, 0x00003c000084e700}; const uint64_t HEART = {0x00183c7e7e240000, 0x00183c7effff6600, 0x183c7effffffff66, 0x00183c7effff6600}; void displayStatic (tsis muaj dab tsi) {yog (showStatic) {matrixDisplay = STATIC [sIndex]; sIndex = (sIndex + 1) % ARRAY_LENGTH (STATIC); } void heartBeat () {rau (uint8_t i = 0; kuv TIMEOUT) {showStatic = cuav; prevTime = sijhawm tam sim no; dIndex = leftToRight? 0: ARRAY_LENGTH (DYNAMIC) - 1; } // Qhov no yog siv los zam dhau qhov ciam teb. yog (dIndex> = ARRAY_LENGTH (DYNAMIC) || dIndex TIMEOUT) {showStatic = tseeb; } matrix.writeOnePicture (matrixDisplay); matrix.display (); ncua (100); }

Pom zoo: