Cov txheej txheem:

Suab Reactive Pheej Yig Ir Led Sawb: 4 Kauj Ruam
Suab Reactive Pheej Yig Ir Led Sawb: 4 Kauj Ruam

Video: Suab Reactive Pheej Yig Ir Led Sawb: 4 Kauj Ruam

Video: Suab Reactive Pheej Yig Ir Led Sawb: 4 Kauj Ruam
Video: Their Class played Subway Surfers in Real Life 😱🔥 #shorts 2024, Hlis ntuj nqeg
Anonim
Suab Reactive Pheej Yig Ir Led Sawb
Suab Reactive Pheej Yig Ir Led Sawb
Suab Reactive Pheej Yig Ir Led Sawb
Suab Reactive Pheej Yig Ir Led Sawb
Suab Reactive Pheej Yig Ir Led Sawb
Suab Reactive Pheej Yig Ir Led Sawb

Suab Reactive Pheej Yig Ir Led Sawb

zoo, lub tswv yim tuaj tom qab coj sawb tuaj txog ntawm AliExpress thiab lawv tsis yog neopixels tab sis RGB LED sawb nrog 44krys lossis 24 hom tseem ceeb nyob deb, Dumb kuv lol, kuv xaj qhov tsis raug. !! Niaah. Yog li kuv tau khawm kuv lub tes tsho thiab googled nws.

Tau txais esp raws IR Web server uas qhia tib cov nyees khawm nyob deb tshaj IR emitter tus pin txuas nrog rau IR coj.

tab sis kuv xav tau qee yam sib txawv xws li lub suab rov ua dua, kuv tau txais ntau Tutorials nrog ws1811 lossis neopixels thiab qee qhov txawm tias nrog MOSFETs thiab LED's, tab sis kuv tsis muaj sijhawm yog li kuv tau sim Dumb mus kom ze ntawm Mapping Suab txawm hais tias A0 PIn ntawm esp thiab Kov cov zis hauv cov thoob kom pab tau qee qhov sib txuas ua ke ntawm IR tej thaj chaw deb khawm MOstly rgb nkaus xwb tab sis kuv twv koj yuav ua kom nws zoo dua kuv.

Khoom siv

1. lub LED Strips pom tseeb nrog Lub Hwj Huam

2. esp8266 / node mcu

3. Ir Emitter coj

4. Ib tus neeg tiv thaiv

5. Programming cable

6. arduino xav

7. ib lub raj hlau (qee qhov yooj yim soldering)

8. a 7805 ic (rau kev siv coj los ua khoom siv esp)

9. Ib mmicrophone module lossis aux y phua rau suab tawm tswv yim

Kauj ruam 1: Npaj Esp

  • Ua ntej tshaj plaws, txuas Nodemcu nrog lub khoos phis tawj lossis laptop.
  • Tam sim no teeb tsa tus tsav tsheb ntawm nodemcu (google nws).
  • Tom qab qhib qhov no, Arduino IDE (Tau kawg koj yuav tsum rub nws thiab teeb nws) Nyem rau "Cov cuab yeej" ntawm Arduino toolbar nyem rau ntawm "Pawg" Xaiv "Tus Thawj Saib Xyuas Haujlwm" thiab tshawb rau esp8266 nruab nws (yuav siv qee lub sijhawm los ua kom tiav))
  • Tam sim no, xaiv "Sketch" los ntawm Arduino toolbar xaiv "Xws li Lub Tsev Qiv Ntawv" los ntawm qhov ntawd xaiv "Tswj cov tsev qiv ntawv" Tshawb nrhiav "IRremoteESP8266" thiab nruab nws
  • Tam sim no kev teeb tsa tau ua tiav tsuas yog los ntawm "Cuab Yeej" peb yuav tsum mus rau "Cov laug cam" Xaiv "NodeMcu 1.0 (ESP 12-E)" lossis lwm yam ntawm ESP8266.

Kauj Ruam 2: Npaj thiab Xeem IR LED

Npaj thiab Xeem IR LED
Npaj thiab Xeem IR LED

Ua ntej tshaj plaws, peb yuav tsum teeb tsa lub tsev qiv ntawv irLED rau esp

Mus ntawm no

Txheeb xyuas koj cov hlua coj los yog 24 tus yuam sij lossis 44 tus yuam sij (loj dua) cov chaw taws teeb

kom tau txais cov lej cim nyob ntawm no

Nrog lub tsev qiv ntawv teeb tsa peb yuav tsum npaj peb IR LED los ntawm kev txuas nws raws li qhia hauv Duab. Basing ntawm nws txuas IR LED, tom qab ntawd rub cov Sketch hauv qab no thiab taw tes IR LED mus rau tus tswj. LED sawb yuav tsum ntsais (tig rau thiab tawm). // ua haujlwm ob qho tib si nrog 24 thiab 44 tus yuam sij Chaw Taws Teeb.

HERE yog tus lej kom ua li ntawd.

#define IR_OFF 0xF740BF // Resective ir cov lej hauv 32 khoom #txhais IR_ON 0xF7C0 #include <IRremoteESP8266.h IRsend irsend (4); // IR pin void teeb () {irsend.begin (); } void loop () {irsend.sendNEC (IR_ON, 32); ncua (5000); irsend.sendNEC (IR_OFF, 32); ncua (5000); }

Kauj Ruam 3: Txuas thiab Npaj Microphone

Teeb thiab Npaj Lub Microphone
Teeb thiab Npaj Lub Microphone
Teeb thiab Npaj Lub Microphone
Teeb thiab Npaj Lub Microphone

Peb yuav siv tsuas yog Analog tus pin ntawm Espe8266 A0 rau Kev Siv Tawm Tswv Yim raws li Analog teeb liab thiab Siv nws los ua rau ir coj raws li Suab

Txuas Tus Pin mus rau a0

Txuas 5V rau Vin (AS node mcu tsis muaj 5v tso zis)

yog nws peb yuav ua raws IR LED txuas nrog D2 tus pin rau Tus Txais ntawm LED sawb.

a

Kauj Ruam 4: Tshaj Tawm Txoj Cai thiab Nws Npaj Rau Pob Zeb

Upload Txoj Cai thiab Nws Npaj Rau Pob Zeb
Upload Txoj Cai thiab Nws Npaj Rau Pob Zeb
Upload Txoj Cai thiab Nws Npaj Rau Pob Zeb
Upload Txoj Cai thiab Nws Npaj Rau Pob Zeb

#suav nrog #suav nrog #txhais lub microphonePin A0 int suab; int suab 1; const int irPin = 4; // d2IRsend irsend (irPin); tsis muaj teeb tsa () {Serial.begin (9600); pinMode (microphonePin, INPUT); pinMode (irPin, OUTPUT);} // ir coj Cov Cai #define IR_BPlus 0xFF3AC5 // #define IR_BMinus 0xFFBA45 // #define IR_ON 0xFF827D // #define IR_OFF 0xFF02FD // #define IR_R 0xFFAA5 txhais IR_B 0xFFA25D // #define IR_W 0xFF22DD // #define IR_B1 0xFF2AD5 // #define IR_B2 0xFFAA55 // #define IR_B3 0xFF926D // #define IR_B4 0xFF12ED // #define IR_B5 0xFF7ABF // 0xFFB24D // #define IR_B8 0xFF32CD // #define IR_B9 0xFF38C7 // #define IR_B10 0xFFB847 // #define IR_B11 0xFF7887 // #define IR_B12 0xFF807 // #define IR_B13 0xFF8E7 // #fine / #define IR_B16 0xFFD827 // #define IR_UPR 0xFF28D7 // #define IR_UPG 0xFFA857 // #define IR_UPB 0xFF6897 // #define IR_QUICK 0xFFE817 // #define IR_DOWNR 0xFF08F7 // #define IRF08 txhais IR_SLOW 0xFFC837 // #define IR_DIY1 0xFF30CF // #define IR_DIY2 0xFFB04F // #define IR_DIY3 0xFF708F // #define IR_AUTO 0xFFF00F // #define IR_DIY4 0xFF10EF // #define IR_DIY5 0xFF906F // #define IR_DIY6 0xFF50AF // #define IR_FLASH 0xFFD02F // #define IR_JUMP3 0xFF20DF // #Fine IRFJ0 / void loop () {suab = analogRead (microphonePin); // tau txais lub suab tawm suab nyeem Serial.print (suab); // tawm suab teeb liab nyeem rau Serial display Serial.print (""); yog (suab> 415) {sound1 = daim ntawv qhia (suab, 415, 750, 140, 255); // kuas siab dua qhov muaj txiaj ntsig uas siab dua qhov ntsuas rau qhov ntsuas ntawm 150 - 255} lwm qhov yog (suab> 340 && suab <415) // khaws kev nyeem ntawv offset rau xoom nplai.here offset tus nqi hauv thaj tsam ntawm 340 - 415 (offset tus nqi ntawm 1.45v)..its nyob ntawm qhov sib piv siv hauv Circuit.. {sound1 = daim duab qhia chaw (suab, 340, 415, 0, 9); } ntxiv yog (suab 240) {irsend.sendNEC (IR_FLASH, 32); irsend.sendNEC (IR_QUICK, 32); irsend.sendNEC (IR_QUICK, 32); irsend.sendNEC (IR_QUICK, 32); irsend.sendNEC (IR_QUICK, 32); irsend.sendNEC (IR_QUICK, 32); irsend.sendNEC (IR_QUICK, 32); } lwm yog ((suab 1)> 200) {irsend.sendNEC (IR_G, 32); irsend.sendNEC (IR_B, 32); ncua (120);} ntxiv yog (suab1> 160) {irsend.sendNEC (IR_R, 32); irsend.sendNEC (IR_B, 32); ncua (120); } lwm yog (suab 1> 120) {irsend.sendNEC (IR_B, 32); ncua (120); } lwm yog (suab 1> 80) {irsend.sendNEC (IR_B, 32); ncua (120); } lwm yog (suab 1> 40) {irsend.sendNEC (IR_G, 32); ncua (120); } lwm yog (suab 1> 10) {irsend.sendNEC (IR_R, 32); ncua (120);} ntxiv {irsend.sendNEC (IR_FADE7, 32); ncua (120); } Serial.println (suab 1); ncua (50); }

Pom zoo: