Cov txheej txheem:

DIY Inventive ART Project Lub Tswv Yim Nrog LED Teeb thiab Suab: 3 Kauj Ruam
DIY Inventive ART Project Lub Tswv Yim Nrog LED Teeb thiab Suab: 3 Kauj Ruam

Video: DIY Inventive ART Project Lub Tswv Yim Nrog LED Teeb thiab Suab: 3 Kauj Ruam

Video: DIY Inventive ART Project Lub Tswv Yim Nrog LED Teeb thiab Suab: 3 Kauj Ruam
Video: 5 Daily Must-Have Habits for Immune System Health Webinar 2024, Kaum ib hlis
Anonim
DIY Inventive ART Project Lub Tswv Yim Nrog LED Teeb thiab Suab
DIY Inventive ART Project Lub Tswv Yim Nrog LED Teeb thiab Suab

Hauv qhov vis dis aus no kuv yuav los qhia koj yuav ua li cas thiaj tsim tau ib qho txuj ci tshwj xeeb hauv tsev siv LED sawb thiab suab.

Kauj ruam 1: Project Video

Image
Image

LED Sawb -

MP3 Player -

Infrared Sensor -

Microcontroller -

Txuas -

Adapter -

Voltage Regulator -

Hais lus -

Micro SD -

Capacitor -

Resistor -

Toggle Hloov -

Cov Cuab Yeej Cuab Yeej -

Kauj ruam 2: Schematic thiab Gerber

Schematic thiab Gerber
Schematic thiab Gerber

Tau txais Pawg Thawj Coj -

Kauj ruam 3: Source Code

Qhov Code
Qhov Code

Source Code:

#suav nrog

#include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h" #define NUM_LEDS_PER_STRIP 70 #define BRIGHTNESS 200 #define LED1pin 5 #define LED2pin 6 #define LED3pin 7 const int IR1pin = A0; const int IR2pin = A1; const int IR3pin = A2; CRGB LED1color [NUM_LEDS_PER_STRIP]; CRGB LED2color [NUM_LEDS_PER_STRIP]; CRGB LED3color [NUM_LEDS_PER_STRIP]; SoftwareSerial mySoftwareSerial (10, 11); // RX, TX DFRobotDFPlayerMini myDFPlayer; void printDetail (uint8_t yam, int tus nqi); teeb tsa tsis muaj dab tsi () {mySoftwareSerial.begin (9600); Serial.begin (115200); yog (! myDFPlayer.begin (mySoftwareSerial)) {Serial.println (F ("Tsis tuaj yeem pib:")); Serial.println (F ("1. Please check the connection!")); Serial.println (F ("2. Please insert the SD card!")); thaum (muaj tseeb); } pinMode (IR1pin, INPUT); pinMode (IR2pin, INPUT); pinMode (IR3pin, INPUT); myDFPlayer.volume (20); myDFPlayer. EQ (DFPLAYER_EQ_CLASSIC); myDFPlayer.outputDevice (DFPLAYER_DEVICE_SD); FastLED.addLeds (LED1color, NUM_LEDS_PER_STRIP); FastLED.addLeds (LED2color, NUM_LEDS_PER_STRIP); FastLED.addLeds (LED3color, NUM_LEDS_PER_STRIP); FastLED.setBrightness (BRIGHTNESS); } void loop () {yog (digitalRead (IR1pin) == LOW) {LED1show (); } yog (digitalRead (IR2pin) == LOW) {LED2show (); } yog (digitalRead (IR3pin) == LOW) {LED3show (); }} void LED1show () {myDFPlayer.play (1); rau (int i = 0; i = 0; i--) {LED1color = CRGB:: Ntsuab; FastLED.show (); LED1color [kuv] = CRGB:: Dub; ncua (100); } myDFPlayer.pause (); } void LED2show () {myDFPlayer.play (2); rau (int i = 0; i = 0; i--) {LED2color = CRGB:: Ntsuab; FastLED.show (); LED2color = CRGB:: Dub; ncua (100); } myDFPlayer.pause (); } void LED3show () {myDFPlayer.play (3); rau (int i = 0; i = 0; i--) {LED3color = CRGB:: Ntsuab; FastLED.show (); LED3color = CRGB:: Dub; ncua (100); } myDFPlayer.pause (); }

Pom zoo: