Cov txheej txheem:

LED Sawb Snowflake / Star Animations: 5 Kauj Ruam
LED Sawb Snowflake / Star Animations: 5 Kauj Ruam

Video: LED Sawb Snowflake / Star Animations: 5 Kauj Ruam

Video: LED Sawb Snowflake / Star Animations: 5 Kauj Ruam
Video: Vinegar VS Bacteria under the microscope! 2024, Kaum ib hlis
Anonim
Image
Image
Ua qauv Snowflake / Star
Ua qauv Snowflake / Star

Phau ntawv qhia me me txog yuav ua li cas kuv tsim kho kom zoo nkauj Christmas nrog LEDs kab txaij kuv tau tso tseg los ntawm lwm qhov haujlwm. Cov phiaj xwm, software thiab cov ntawv ua kom pom tseeb tau muab. Txoj haujlwm no tau tshoov siab los ntawm cov vis dis aus hauv qab no hauv youtube.

Kauj Ruam 1: Ua qauv Snowflake / Star

Thawj kauj ruam yog los npaj cov qauv kev txhawb nqa rau LEDs qhov no tau ua tiav nrog Inkscape. Lub tswv yim yog kom muaj Snowflake nrog Lub Hnub Qub sab hauv. Dav tau xaiv los ua qhov dav ntawm ob daim kab xev kom muaj peev xwm tsim txhua yam nrog ib kab rov qab los ntawm nws tus kheej.

Kauj Ruam 2: Tsim Kev Txhawb Nqa

Tsim Kev Txhawb Nqa
Tsim Kev Txhawb Nqa

Kev txhawb nqa yog tsim los ntawm ntoo thiab sib dhos nrog cov kua nplaum kub.

Kauj Ruam 3: Soder LED Sawb

Soder LED Sawb
Soder LED Sawb
Soder LED Sawb
Soder LED Sawb

Cov hlua LEDs tau txiav rau qhov ntev uas raug rau txhua ntu thiab tom qab ntawd ua ke ua ke nrog npaj cov xov hlau. Qhov no siv sijhawm ntev thiab kuv xav kom coj cov LEDs ntawm cov hlau tsis txhob txiav cov kab.

Kauj Ruam 4: LEDs Tsav Tsheb

LEDs tsav tsheb
LEDs tsav tsheb

Hauv qhov haujlwm no LEDs tsis tau tsav los ntawm Arduino, tab sis yog NodeMCU board (ESP8266) nrog MicroPython ntawm nws.

Thawj kauj ruam yog sab saum toj nyem micropython firmware raws li phau ntawv qhia no: Pib nrog MicroPython ntawm ESP8266. Nws yog qhov ua tau siv nws los tsav cov LEDs zoo li qhia hauv 11. Tswj NeoPixels.

Ntawm kuv lub Rooj Tswjhwm Saib Machine.pin (4) yog D2 (raws li pom hauv daim duab). Tsis txhob hnov qab txuas lub gnd nrog LEDs.

Kauj ruam 5: Software thiab Animations

Image
Image

Cov software sau hauv Python tuaj yeem rub tawm ntawm kuv GitHub.

Cov ntaub ntawv main.py saib xyuas kev ua yeeb yaj kiab. Nws tuaj yeem muaj hom moos uas lub sijhawm tau tshwm sim ua feem pua ntawm cov lej ntawm LEDs. Thiab kuj tseem muaj txhua qhov kev ua yeeb yaj kiab uas pom hauv daim vis dis aus uas tuaj yeem theej los ntawm cov ntawv animations.txt. Cov yeeb yaj kiab ua rau peb ntawm snowflake_esp.py module uas muaj chav kawm Snowflake kom yooj yim nkag tau txhua qhov ntawm cov qauv. Yog li nws tuaj yeem tswj hwm txhua lub LEDs ua ke lossis tsuas yog lub hnub qub, lossis tsob ntoo, nplooj ntoo lossis pob tw ntawm txhua caj npab, nqes mus rau tus kheej LED.

Piv txwv li:

los ntawm snowflake_esp ntshuam *sf = Snowflake (0)

tawm = Xim (0, 0, 0) def tos (ms): time.sleep (ms/1000.0) --- lub hnub qub loj thiab me me nrog kev hloov snowflake y = Xim (255, 220, 0) sf.paint (tawm) sf.star.color (y) tos (1000) sf.star.paint (tawm) sf.trees.color (w) tos (1000) sf.trees.trunk.paint (tawm) sf.trees.leaf.color (y) tos (1000)

Pom zoo: