mirror of
https://github.com/serega404/SpinningMemePlatform.git
synced 2026-05-26 18:09:20 +03:00
Upload
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1 +1,26 @@
|
|||||||
# I-am-just-a-fish
|

|
||||||
|
|
||||||
|
## О проекте
|
||||||
|
|
||||||
|
Небольшое устройство воспроизводящее звук и управляющее двигателем, созданное ради шутки, а точнее ради мема с крутящимися объектами под музыку.
|
||||||
|
|
||||||
|
## Инструкция по запуску
|
||||||
|
|
||||||
|
1) Подготовить и отформатировать sd карту в формат FAT32
|
||||||
|
2) Загрузить аудиофайл на флешку (MP3, WAV, WMA)
|
||||||
|
3) Открыть `src.ino` в Arduino IDE
|
||||||
|
4) Выбрать COM порт и модель платы
|
||||||
|
5) Изменить время до оставноки двигателя (`MUSIC_TIME` в коде)
|
||||||
|
6) Прошить
|
||||||
|
|
||||||
|
## Схема устройства
|
||||||
|
|
||||||
|
### Arduino
|
||||||
|
<img src="img/NANO Вариант.png" height="250" />
|
||||||
|
|
||||||
|
### ESP8266 Lolin
|
||||||
|
<img src="img/ESP Вариант.png" height="250" />
|
||||||
|
|
||||||
|
## Библиотеки
|
||||||
|
|
||||||
|
* [DFPlayerMini_Fast](https://github.com/PowerBroker2/DFPlayerMini_Fast)
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 292 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 288 KiB |
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#include <DFPlayerMini_Fast.h>
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
|
|
||||||
|
SoftwareSerial playerSerial(4, 5); // RX, TX
|
||||||
|
|
||||||
|
DFPlayerMini_Fast myMP3;
|
||||||
|
int buttonState = 0;
|
||||||
|
|
||||||
|
#define MUSIC_TIME 140000 // время песни в мс (для остановки двигателя)
|
||||||
|
uint32_t tmr; // переменная таймера
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
playerSerial.begin(9600);
|
||||||
|
myMP3.begin(playerSerial, true);
|
||||||
|
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
Serial.println("Установка максимальной громкости");
|
||||||
|
myMP3.volume(30);
|
||||||
|
|
||||||
|
Serial.println("Воспроизведение остановлено");
|
||||||
|
myMP3.stop();
|
||||||
|
|
||||||
|
pinMode(15, OUTPUT);
|
||||||
|
pinMode(16, INPUT);
|
||||||
|
|
||||||
|
analogWrite(15, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
buttonState = digitalRead(16);
|
||||||
|
if (buttonState == HIGH) {
|
||||||
|
Serial.println("Устройство активировано");
|
||||||
|
myMP3.play(1);
|
||||||
|
analogWrite(15, 120);
|
||||||
|
tmr = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (millis() - tmr >= MUSIC_TIME) {
|
||||||
|
analogWrite(15, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user