Cov txheej txheem:

Keypad Module Piano Nrog RGB LED: 5 Kauj Ruam (nrog Duab)
Keypad Module Piano Nrog RGB LED: 5 Kauj Ruam (nrog Duab)

Video: Keypad Module Piano Nrog RGB LED: 5 Kauj Ruam (nrog Duab)

Video: Keypad Module Piano Nrog RGB LED: 5 Kauj Ruam (nrog Duab)
Video: Apple always leaves their products so close to the edge #shorts #appleevent 2024, Hlis ntuj nqeg
Anonim
Image
Image
Cov Ntaub Ntawv Xav Tau
Cov Ntaub Ntawv Xav Tau

Intro

Nyob zoo cov poj niam thiab txiv neej, zoo siab txais tos rau kuv thawj qhov kev qhia! Hnub no, kuv yuav qhia koj yuav tsim lub piano li cas nrog lub hauv paus tseem ceeb yog tus lej ntsuas phoo thiab piezo buzzer thiab nws muaj peev xwm ua si DO-RE-MI thiab lwm yam.

Cov keypad module feem ntau yog lub hom phiaj xav tau, yog ua lub keyboard ua ke nrog arduino RFID los tsim lub thawv nyab xeeb rau cov khoom muaj txiaj ntsig. Hauv qhov no kuv tau hloov cov keyboard, tsis txhob tiv thaiv qee yam uas kuv txiav txim siab siv los hais lus yooj yim thiab muaj suab paj nruag.

Lub Tswv Yim Tswv Yim

Lub tswv yim lub tswv yim rau kev tsim no, hloov pauv los ntawm kev nco zoo siab yooj yim thaum ua si xylophone thaum kuv tseem yau hauv chav kawm suab paj nruag. Tus nqi ntawm kev xyiv fab thiab kev zoo siab tau khiav los ntawm kuv lub cev yog ntawm nws qhov siab, Kuv txhais tau tias txhua tus menyuam tau yooj yim txaus siab thiab kuv txaus siab tau ua si xylophone.

Kev tshawb fawb

Tom qab koj lub tswv yim lub teeb pom kev saum toj no teeb, yuav tsum tau tshawb fawb me ntsis. Tom qab tshawb xyuas lub vev xaib rau qee lub sijhawm, Kuv tuaj yeem hla kuv lub tswv yim kuv xub xav txog! Ib tus keypad module tig piano, ib tus neeg tau tsim tib qhov project video ntawm no. Xav ua ntej kuv xav tau ntxiv cov khoom sib cais uas yuav txuas ntxiv txhim kho txoj haujlwm tab sis ua rau nws muaj kev koom tes ntau dua thiab tuaj yeem hu nws ua kuv tus kheej.

Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau

Cov Ntaub Ntawv Xav Tau
Cov Ntaub Ntawv Xav Tau
Cov Ntaub Ntawv Xav Tau
Cov Ntaub Ntawv Xav Tau
Cov Ntaub Ntawv Xav Tau
Cov Ntaub Ntawv Xav Tau

Cov Khoom Qhia

  • Piezo Buzzer 1x ▶
  • 4x4 keypad module 1x ▶
  • Arduino Uno 1x ▶
  • USB 2.0 cable hom A/B 1x ▶
  • Suab Sensor Module 1x ▶
  • RGB LED 1x ▶
  • 330 ohm resistor 3x ▶
  • Txiv neej rau poj niam jumper hlau 8x ▶
  • Txiv neej rau txiv neej jumper hlau 4x ▶
  • 3 tus pin Txiv neej rau poj niam jumper hlau 1x ▶

Cov npe khoom yog nyob rau hauv-kev txiav txim nrog cov duab saum toj no.

Kauj ruam 2: Lub Sijhawm Ua Haujlwm

Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!
Lub Sijhawm Ua Haujlwm!

4x4 Keypad Module & Piezo Buzzer

Txoj kev xav

Raws li 4x4 tus lej keypad thiab piezo buzzer muaj ntau tus lej tus lej nkag thiab kuv yuav txiav txim siab faib cov khoom siv ua ob khub. Tsom ntsoov rau ntawm cov keyboard, feem ntau yog siv los ua tswv yim. SunFounder 4*4 Matrix Keypad Module yog cov lej uas tsis muaj tus lej nkag los suav nrog 16 tus yuam sij ua ke, Cov yuam sij ntawm txhua kab thiab kab txuas tau txuas nrog los ntawm tus pin sab nraud- tus pin Y1-Y4 raws li sau rau ntawm ib sab tswj kab, thaum X1- X4, kab.

Lub Hom Phiaj

Lub hom phiaj ntawm cov khoom siv no rau tag nrho txoj haujlwm, yog tso cai rau tus neeg siv nias lub pob uas tau teeb tsa rau lub suab tshwj xeeb tsim los ntawm piezo buzzer los ntawm zaus hauv hertz.

Matrix Module Pin - Arduino Pin

  • 4 - 2
  • 3 - 3
  • 2 - 4
  • 1 - 5
  • 5 - 6
  • 6 - 7
  • 7 - 8
  • 8 - 13

Piezo Buzzer - Arduino Pin

Dub - GND

Liab - Fais fab

Kuv txoj haujlwm nyuaj tshaj plaws hauv qhov kev tsim no yog xam tawm qhov twg txhua lub xaim txuas rau. Saum toj no kuv muab rau koj thiab nrawm thiab yooj yim yuav ua li cas txoj hauv kev ntawm cov xaim hlau, tsuav yog ua raws saum toj mus rau hauv qab, cov lus qhia yog siv koj lub sijhawm thiab xyuas kom txhua tus pin raug nkag mus rau hauv qhov raug.

*Cov lus qhia yog ua raws qhov twg txhua lub xov hlau nyob ntawm ib kawg mus rau lwm qhov.

Txhua Tinkercad cov duab kos ntawm cov khoom sib txuas tshwj xeeb yog xim xim raug yog li ua raws nrog ua tib zoo

Kauj Ruam 3: Suab Sensor Module thiab RGB LED

Suab Sensor Module thiab RGB LED
Suab Sensor Module thiab RGB LED
Suab Sensor Module thiab RGB LED
Suab Sensor Module thiab RGB LED
Suab Sensor Module thiab RGB LED
Suab Sensor Module thiab RGB LED

Suab Sensor Module thiab RGB LED

Txoj kev xav

Lub suab sensor module tso cai rau koj kom paub thaum lub suab tau dhau qhov teeb tsa taw tes koj xaiv. Lub suab tau pom ntawm lub microphone thiab pub rau hauv LM393 op amp. Thaum lub suab nrov dhau qhov teeb tsa taw tes, ib qho LED ntawm tus qauv teeb pom kev zoo thiab tso tawm.

Lub Hom Phiaj

Lub hom phiaj ntawm cov khoom siv no rau tag nrho txoj haujlwm, yog kom tau txais lub suab/ntim nyeem ntawv ntawm lub suab ntsuas qhov ntsuas thiab dhau los ntawm kev nyeem ntawv RGB LED yuav qhib qhov tseeb xim ntsig txog lub suab.

Suab Sensor Module - Arduino Pin (Siv 3 Pin Jumper Wire)

  • Cov Zis - A0 Analog Pin
  • GND - Txhua qhov qhib GND tus pin qhov
  • VCC - 3V

RGB Common Anode (+) LED - Arduino Pin

  • Liab - 9
  • Hwj chim - 5V
  • Ntsuab - 10
  • Xiav - 11

Nco ntsoov xaim, txhua tus neeg xaim hla 330 ohm resistor. Siv daim duab saum toj no raws li siv.

Kuv txoj haujlwm nyuaj tshaj plaws hauv qhov kev tsim no yog xam tawm qhov twg txhua lub xaim txuas rau. Saum toj no kuv muab rau koj thiab nrawm thiab yooj yim yuav ua li cas mus rau ntawm cov chaw xaim, tsuav yog ua raws saum toj mus rau hauv qab, cov lus qhia yog siv koj lub sijhawm thiab xyuas kom txhua tus pin raug nkag mus rau hauv qhov raug kom tiv thaiv kev debugging yav tom ntej.

*Cov lus qhia yog ua raws qhov twg txhua lub xaim txuas rau ib qho

Txhua Tinkercad cov duab kos ntawm cov khoom sib txuas tshwj xeeb yog xim xim raug yog li ua raws

Kauj ruam 4: Code

Code

Txoj cai no tso cai rau txhua lub Cheebtsam los ua haujlwm ua ke los ntawm kev siv lub luag haujlwm tshiab tau teev tseg kom muaj txhua qhov kev tswj hwm ib qho uas muaj ntau qhov kev hloov pauv uas cov khoom siv tau yog RGB coj thiab siv rgb xim hloov xim thaum nyob thiab piezo buzzer thiab suab nws yuav ua nyob ntawm qhov khawm thawb.

Yuav tsum muaj nyob hauv txoj cai no yog lub tsev qiv ntawv keyboard

Txuas ntawm no:

Thaum rub tawm ntxiv lub tsev qiv ntawv tshiab rau hauv arduino, tom qab ntawd ntxig ib kab ntawm cov cai xav tau los qhib nws.

Cov teeb meem Kuv tau muaj thaum lub chaws nyob qhov twg tso cov haujlwm tshiab uas tau txhais los ntawm kev sim thiab ua yuam kev Kuv xav tias nws yuav tsum tau teeb tsa thiab tsis yog lub voj.

Code

#suav nrog // Keypad Library

int greenPin = 11; // RGB Green Pin txuas nrog tus lej digital 9

int redPin = 10; // RGB Red Pin txuas nrog tus lej digital 9

int bluePin = 9; // RGB Blue Pin txuas nrog tus lej digital 9 int speakerPin = 12; // hais lus txuas nrog digital pin 12 const byte ROWS = 4; // plaub kab const byte COLS = 4; // plaub coloums const int soundPin = A0; // lub suab sensor txuas rau A0

tus yuam sij [ROWS] [COLS] = {

{'a', 'b', 'c', 'd'}, {'e', 'f', 'g', 'h'}, {'i', 'j', 'k', ' l '}, {' m ',' n ',' o ',' p '}}; // Visualization ntawm keypad module

byte rowPins [ROWS] = {2, 3, 4, 5}; // txuas rau kab pinouts ntawm cov keyboard

byte colPins [COLS] = {6, 7, 8, 13}; // txuas mus rau colum pinouts ntawm cov keyboard

Keypad keypad = Keypad (uaKeymap (tuav), rowPins, colPins, ROWS, COLS); // Tsim cov yuam sij

void teeb tsa () {

pinMode (speakerPin, OUTPUT); // teeb tus speakerPin los ua qhov tso tawm

pinMode (redPin, OUTPUT); // teeb tsa tus pin liab los ua tus pinMode (greenPin, OUTPUT); // teeb tsa tus pin ntsuab los ua tus pinMode (bluePin, OUTPUT); // teeb tus pin xiav los ua qhov tso tawm

Serial.begin (9600);

} tsis muaj dab tsi setColor (int liab, int ntsuab, int xiav) // Lub luag haujlwm tshiab tau tso cai kom RGB tso saib xim los ntawm RGB code {#ifdef COMMON_ANODE liab = 255 - liab; ntsuab = 255 - ntsuab; xiav = 255 - xiav; #endif analogWrite (redPin, liab); analogWrite (greenPin, ntsuab); analogWrite (bluePin, xiav); }

void beep (unsigned char speakerPin, int frequencyInHertz, sijhawm ntevInMilliseconds) {// lub suab tsim ua haujlwm

tus x; ncua sij hawm ntevAmount = (ntev) (1000000/zausInHertz); ntev looTime = (ntev) ((timeInMilliseconds*1000)/(delayAmount*2)); rau (x = 0; x

void voj () {

char tseem ceeb = keypad.getKey (); int tus nqi = analogRead (soundPin); // nyeem tus nqi ntawm A0 Serial.println (tus nqi); // luam tawm tus nqi

yog (qhov tseem ceeb! = NO_KEY) {

Serial.println (qhov tseem ceeb); } yog (qhov tseem ceeb == 'a') {beep (speakerPin, 2093, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'b') {beep (speakerPin, 2349, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'c') {beep (speakerPin, 2637, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'd') {beep (speakerPin, 2793, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'e') {beep (speakerPin, 3136, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'f') {beep (speakerPin, 3520, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'g') {beep (speakerPin, 3951, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'h') {beep (speakerPin, 4186, 100); setColor (218, 112, 214); } yog (qhov tseem ceeb == 'kuv') {beep (speakerPin, 2093, 100); setColor (230, 230, 0); } yog (qhov tseem ceeb == 'j') {beep (speakerPin, 2349, 100); setColor (180, 255, 130); } yog (qhov tseem ceeb == 'k') {beep (speakerPin, 2637, 100); setColor (130, 255, 130); } yog (qhov tseem ceeb == 'l') {beep (speakerPin, 2739, 100); setColor (130, 220, 130); } yog (qhov tseem ceeb == 'm') {beep (speakerPin, 3136, 100); setColor (0, 255, 255); } yog (qhov tseem ceeb == 'n') {beep (speakerPin, 3520, 100); setColor (0, 220, 255); } yog (qhov tseem ceeb == 'o') {beep (speakerPin, 3951, 100); setColor (0, 69, 255); } yog (qhov tseem ceeb == 'p') {beep (speakerPin, 4186, 100); setColor (255, 0, 255); }}

Kauj Ruam 5: Kev Xav Thaum Kawg

Image
Image

Kev Xav Thaum Kawg

Kev xav zaum kawg ntawm txoj haujlwm no yog nws lub hom phiaj yog ua khoom ua si, kom muaj kev lom zem thiab yooj yim dua. Raws li txoj haujlwm no ua tiav thiab ua haujlwm tiav, Kuv ntseeg tias qhov kev tsim no thiab tuaj yeem txuas ntxiv nrog tej zaum muaj ntau yam ntxiv xws li cov ntaubntawv povthawj siv, lossis theej/simon hais cov ntsiab lus, lossis txawm tias LCD nrog cov ntawv sau uas tshwm los ua nkauj tshwj xeeb.

Kuv yuav nyiam paub koj lub tswv yim txog Keypad Module, yam khoom koj xav tias tuaj yeem muab ntxiv. Puas yog koj yuav siv nws hauv ib qho ntawm koj cov phiaj xwm? Thov tshaj tawm koj lub tswv yim hauv kab lus hauv qab no.

Thov nco ntsoov qhia yog tias koj nyiam qhov haujlwm arduino no.

Pom zoo: