Cov txheej txheem:

Tsawg heev Arduino Sound Effect Box: 5 Kauj Ruam
Tsawg heev Arduino Sound Effect Box: 5 Kauj Ruam

Video: Tsawg heev Arduino Sound Effect Box: 5 Kauj Ruam

Video: Tsawg heev Arduino Sound Effect Box: 5 Kauj Ruam
Video: $600 NYIAJ PAB CA * $3600 CHILD TAX * BIDEN SPEECH * INDIA KAB MOB HNYAV * TOP NEWS+ 04/29/2021 2024, Kaum ib hlis
Anonim
Tsawg heev Arduino Sound Effect Box
Tsawg heev Arduino Sound Effect Box
Tsawg heev Arduino Sound Effect Box
Tsawg heev Arduino Sound Effect Box

Qhov no yog txoj haujlwm nrawm ntawm lub thawv muaj suab nrov. Qhov ntaus ntawv nyeem cov ntaub ntawv ua ntej kaw los ntawm microSD muab rau ib lub pob tshwj xeeb thiab ua si thaum nias.

Kauj ruam 1: Koj Yuav Tsum Tau:

Koj Yuav Tsum Tau
Koj Yuav Tsum Tau
Koj Yuav Tsum Tau
Koj Yuav Tsum Tau
Koj Yuav Tsum Tau
Koj Yuav Tsum Tau

Arduino pro mini (lossis lwm yam) microSD module Ib tus neeg hais lus nrog TRS (mic / aux) kev sib txuas Tus poj niam TRS txuas 4 Push Button4 220ohm ResistorsBattery tuav thiab roj teeb - Kuv siv 2 CR2032 npib roj teeb tab sis koj tuaj yeem siv tau lwm yam ob sab txiv neej TRS (lub mloog pob ntseg) cable

Kauj ruam 2: Kev sib txuas

Kev sib txuas
Kev sib txuas

Txhua cov nyees khawm txuas rau VCC thiab dhau los ntawm 220ohm resistor rau GND (rau rub tawm qhov tsis raug tam sim no ntawm kab ntawv) ua ntej ntawm tus tiv thaiv txhua khawm txuas nrog rau Arduino tus lej digital 5, 6, 7, 8.

TRS txuas tau txuas nrog GND thiab rau Arduino tus lej thib 9 tus lej.

MicroSD module txuas nrog Arduino raws li hauv qab no: GND => GNDVcc => VccMISO => 12MOSI => 11CS => 4SCK => 13

Roj teeb + txuas nrog RAW thiab - rau GND

Kauj Ruam 3: Teeb Cov Ntaub Ntawv Wave

Cov ntaub ntawv wav yuav tsum yog ntawm 16000khz 8bit mono. Name lawv los ntawm tus lej tus lej koj yuav muab rau lawv (1, 2, 3, 4)

Koj tuaj yeem siv lub xaib no los hloov koj cov ntaub ntawv

Kauj ruam 4: Txoj Cai

Txoj cai siv 2 lub tsev qiv ntawv koj yuav tsum paub tseeb tias koj muaj (yog tias koj tsis rub tawm los ntawm tus thawj tswj lib): SD.hTMRpcm.h

#include // suav nrog SD module tsev qiv ntawv #suav nrog // suav nrog hais lus tswj lub tsev qiv ntawv #define SD_ChipSelectPin 4 // txhais CS tus pin #define B1 5 // 4 khawm pins txuas #define B2 6 #define B3 8 TMRpcm tmrpcm; // tsim qhov khoom rau tus hais lus lub tsev qiv ntawv tsis muaj teeb tsa () {Serial.begin (9600); pinMode (5, INPUT); // 4 lub hauv paus pib ua INPUTS pinMode (6, INPUT); pinMode (7, INPUT); pinMode (8, INPUT); tmrpcm.speakerPin = 9; // txhais tus pin tus hais lus. // koj yuav tsum siv tus pin 9 ntawm Arduino Uno thiab Nano // lub tsev qiv ntawv siv tus pin no yog (! // tsis txhob ua dab tsi ntxiv yog tias tsis} tmrpcm.setVolume (6); // 0 txog 7. Teev ntim ntim tmrpcm.play ("start.wav"); // lub suab ntawv "1" yuav ua si txhua lub sijhawm arduino muaj zog, lossis rov pib dua} void loop () {// Serial.println (digitalRead (8))); yog (digitalRead (B1)) {Serial.println ("B1"); tmrpcm.play ("1.wav"); ncua (100); } yog (digitalRead (B2)) {Serial.println ("B2"); tmrpcm.play ("2.wav"); ncua (100); } yog (digitalRead (B3)) {Serial.println ("B3"); tmrpcm.play ("3.wav"); ncua (100); } yog (digitalRead (B4)) {Serial.println ("B4"); tmrpcm.play ("4.wav"); ncua (100); }}

Kauj Ruam 5: Kev Sib Txuas zaum kawg…

Txuas lub cuab yeej los ntawm TRS txuas nrog TRS cable rau tus hais lus Txuas lub cuab yeej rau lub zog thiab qhib nws

… Muaj kev lom zem …

Pom zoo: