2025 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2025-01-13 06:58
Bu videoda men sizga LED tasmasi va tovush yordamida uyda noyob san'at loyihasini qanday qilishni ko'rsataman.
1 -qadam: Video loyiha
LED chizig'i -
MP3 pleer -
Infraqizil sensor -
Mikrokontroller -
Ulagich -
Adapter -
Voltaj regulyatori -
Karnay -
Micro SD -
Kondensator -
Qarshilik -
Kalitni almashtirish -
Lehimlash asboblari -
2 -qadam: Sxematik va Gerber
Kengashni oling -
3 -qadam: Manba kodi
Manba kodi:
#qo'shing
#include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h" #NUM_LEDS_PER_STRIP 70 #devetine BRIGHTNESS 200 #define LED1pin 5 #define LED2pin 6 #de3ine LED3pin 7 const int IR1pin = A0; const int IR2pin = A1; const int IR3pin = A2; CRGB LED1 rang [NUM_LEDS_PER_STRIP]; CRGB LED2 rang [NUM_LEDS_PER_STRIP]; CRGB LED3 rang [NUM_LEDS_PER_STRIP]; SoftwareSerial mySoftwareSerial (10, 11); // RX, TX DFRobotDFPlayerMini myDFPlayer; void printDetail (uint8_t turi, int qiymati); void setup () {mySoftwareSerial.begin (9600); Serial.begin (115200); if (! myDFPlayer.begin (mySoftwareSerial)) {Serial.println (F ("Boshlash mumkin emas:")); Serial.println (F ("1. Iltimos, ulanishni qayta tekshiring!")); Serial.println (F ("2. Iltimos, SD -kartani joylashtiring!"))); while (rost); } pinMode (IR1pin, INPUT); pinMode (IR2pin, INPUT); pinMode (IR3pin, INPUT); myDFPlayer.volume (20); myDFPlayer. EQ (DFPLAYER_EQ_CLASSIC); myDFPlayer.outputDevice (DFPLAYER_DEVICE_SD); FastLED.addLeds (LED1 rang, NUM_LEDS_PER_STRIP); FastLED.addLeds (LED2color, NUM_LEDS_PER_STRIP); FastLED.addLeds (LED3color, NUM_LEDS_PER_STRIP); FastLED.setBrightness (Yorqinligi); } void loop () {if (digitalRead (IR1pin) == LOW) {LED1show (); } if (digitalRead (IR2pin) == LOW) {LED2show (); } if (digitalRead (IR3pin) == LOW) {LED3show (); }} bo'sh LED1show () {myDFPlayer.play (1); uchun (int i = 0; i