Talaan ng mga Nilalaman:
2025 May -akda: John Day | [email protected]. Huling binago: 2025-01-13 06:58
Sa video na ito ipapakita ko sa iyo kung paano gumawa ng natatanging proyekto sa sining sa bahay gamit ang LED strip at tunog.
Hakbang 1: Video ng Proyekto
LED Strip -
MP3 Player -
Infrared Sensor -
Microcontroller -
Connector -
Adapter -
Voltage Regulator -
Tagapagsalita -
Micro SD -
Capacitor -
Resistor -
Toggle Switch -
Mga Tool sa Paghihinang -
Hakbang 2: Schematic at Gerber
Kunin ang Lupon -
Hakbang 3: Source Code
Source Code:
# isama
# isama ang "SoftwareSerial.h" # isama ang "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; walang bisa ang printDetail (uri ng uint8_t, int halaga); void setup () {mySoftwareSerial.begin (9600); Serial.begin (115200); kung (! myDFPlayer.begin (mySoftwareSerial)) {Serial.println (F ("Hindi masimulan:")); Serial.println (F ("1. Mangyaring suriin muli ang koneksyon!")); Serial.println (F ("2. Mangyaring ipasok ang SD card!")); habang (totoo); } 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.setBightness (BRIGHTNESS); } void loop () {kung (digitalRead (IR1pin) == LOW) {LED1show (); } kung (digitalRead (IR2pin) == LOW) {LED2show (); } kung (digitalRead (IR3pin) == LOW) {LED3show (); }} walang bisa LED1show () {myDFPlayer.play (1); para sa (int i = 0; i