2025 Autor: John Day | [email protected]. Zadnja promjena: 2025-01-13 06:57
U ovom videu pokazat ću vam kako napraviti jedinstven umjetnički projekt kod kuće pomoću LED trake i zvuka.
Korak 1: Video projekt
LED traka -
MP3 player -
Infracrveni senzor -
Mikrokontroler -
Konektor -
Adapter -
Regulator napona -
Zvučnik -
Mikro SD -
Kondenzator -
Otpornik -
Preklopni prekidač -
Alati za lemljenje -
Korak 2: Shema i Gerber
Nabavite ploču -
Korak 3: Izvorni kod
Izvorni kod:
#uključi
#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 LED1boja [NUM_LEDS_PER_STRIP]; CRGB LED2boja [NUM_LEDS_PER_STRIP]; CRGB LED3boja [NUM_LEDS_PER_STRIP]; SoftwareSerial mySoftwareSerial (10, 11); // RX, TX DFRobotDFPlayerMini mojDFPlayer; void printDetail (vrsta uint8_t, vrijednost int); void setup () {mySoftwareSerial.begin (9600); Serial.begin (115200); if (! myDFPlayer.begin (mySoftwareSerial)) {Serial.println (F ("Nije moguće započeti:")); Serial.println (F ("1. Provjerite ponovno vezu!")); Serial.println (F ("2. Molim umetnite SD karticu!")); while (istina); } pinMode (IR1pin, INPUT); pinMode (IR2pin, INPUT); pinMode (IR3pin, INPUT); myDFPlayer.volume (20); myDFPlayer. EQ (DFPLAYER_EQ_CLASSIC); myDFPlayer.outputDevice (DFPLAYER_DEVICE_SD); FastLED.addLeds (LED1boja, NUM_LEDS_PER_STRIP); FastLED.addLeds (LED2boja, NUM_LEDS_PER_STRIP); FastLED.addLeds (LED3boja, NUM_LEDS_PER_STRIP); FastLED.setBrightness (BRIGHTNESS); } void loop () {if (digitalRead (IR1pin) == LOW) {LED1show (); } if (digitalRead (IR2pin) == LOW) {LED2show (); } if (digitalRead (IR3pin) == LOW) {LED3show (); }} void LED1show () {myDFPlayer.play (1); za (int i = 0; i