Cov txheej txheem:
- Kauj ruam 1: Hlau Keypad
- Kauj ruam 2: Ntxiv Micro Servo
- Kauj Ruam 3: Hloov Kho Txoj Cai los Siv Cov Keypad ntawm Servo
Video: Servo Positoning Nrog Keypad: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Hauv cov lus qhia no peb yuav tsim ib qhov haujlwm uas yuav tswj hwm Micro-Servo nrog cov keyboard ua haujlwm nrog Arduino Uno.
Cov Khoom Siv:
Arduino Ib
Cov qhob cij
4 x 4 Keypad
Micro-Servo Cov
Kauj ruam 1: Hlau Keypad
Thawj qhov xav tias koj yuav tsum tau ua yog xaim lub tsheb nqaj hlau fais fab thiab tsheb nqaj hlau hauv av ntawm koj lub khob cij los ntawm koj li Arduino
- Txuas tus pin 5V rau lub tsheb ciav hlau (liab)
- Txuas tus pin hauv av (GND) rau txoj kev tsheb ciav hlau (xiav)
Tam sim no tias daim ntawv qhia zaub mov muaj lub zog thiab yog hauv av, peb tuaj yeem pib txuas mus rau peb cov khoom siv.
Kev xaim lub Keypad yog ib qho yooj yim tab sis koj yuav tsum tau sau tseg ntawm tus pin ntawm cov keyboard thiab arduino. Nws yuav yooj yim dua thaum peb tig los mloog peb cov cai.
Nco ntsoov pib ntawm sab laug thaum siv koj cov xov hlau!
- Thawj tus pin mus rau 13
- Tus pin thib ob mus rau 12
- Tus pin thib peb mus rau 11
- Plaub tus pin mus rau 10
- Thib tsib tus pin rau 9
- Sixth Pin rau 8
- Xya tus Pin rau 7
- Yim Pin rau 6
Thaum xaim lub keypad, nco ntsoov khaws lub pwm pwm tus lej qhib. Peb yuav xav tau nws rau micro-servo
Ua ntej peb mus rau txoj cai, nco ntsoov tias koj tau teeb tsa Lub Tsev Qiv Ntawv Keypad. Nws tuaj yeem pom hauv koj daim duab, tom qab kos duab tab, suav nrog tsev qiv ntawv. Koj yuav tsis muaj peev xwm siv lub keypad yam tsis muaj nws.
Tam sim no cia tig mus rau txoj cai thiab xyuas kom cov keypad ua haujlwm thiab muab cov txiaj ntsig koom nrog
Cov Lus Cim Ceev: Nco ntsoov tias koj muaj daim ntawv yog los tshuaj xyuas lub keyboard, txwv tsis pub nws yuav tsis ua haujlwm. Kuj yuav tsum ceev faj ntawm kev ncua, lawv yuav cuam tshuam nrog cov nyees khawm tau sau npe los ntawm cov keyboard
#suav nrog
const byte kab = 4; // plaub kab txij li cov keypad puv lawm
const byte txhua = 4; // plaub kab, tib yam li saum toj no
cov nyees khawm [kab] [kab ntawv] = {
{'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', ' C '}, {'*',' 0 ','#',' D '}};
byte rowP [kab] = {13, 12, 11, 10}; // kab pins ntawm tus keyboard
byte columnsP [kab ntawv] = {9, 8, 7, 6}; // kab pins ntawm tus keyboard
Keypad pad = Keypad (uaKeymap (cov nyees khawm), rowP, kab P, kab, kab, kab); // tsim cov keyboard
void teeb tsa () {
Serial.begin (9600); }
void voj () {
khawm khawm Pressed = pad.getKey (); // tau txais daim npav los ntawm cov keyboard yog tias (khawm Nyem) // qhia lub pob twg tau nyem rau ntawm lub keyboard {Serial.println (buttonPressed); }}
Kauj ruam 2: Ntxiv Micro Servo
Tam sim no cia ntxiv servo motor. Qhov no yog qhov yooj yim ntxiv rau peb txoj haujlwm tam sim no txij li lub micro server tsuas muaj peb lub xov hlau.
- Cov xaim xim av mus rau txoj kev tsheb nqaj hlau ntawm lub khob cij
- Liab mus rau Txoj Kev tsheb nqaj hlau
- Txiv kab ntxwv mus rau Pin 3 ntawm Arduino. Nco ntsoov lub micro server yuav tsum muaj tus pin PWM ntawm Arduino. Qhov no yog vim los ntawm servo siv TIMER2
Tam sim no cia tsuas yog ua kom ntseeg tau tias peb txuas lub micro servo txoj cai thiab nws txav mus
#include #include "Servo.h"
const byte kab = 4; // plaub kab txij li cov keypad puv lawm
const byte txhua = 4; // plaub kab, tib yam li saum toj no
cov nyees khawm [kab] [kab ntawv] = {
{'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', ' C '}, {'*',' 0 ','#',' D '}};
byte rowP [kab] = {13, 12, 11, 10}; // kab pins ntawm tus keyboard
byte columnsP [kab ntawv] = {9, 8, 7, 6}; // kab pins ntawm tus keyboard
Keypad pad = Keypad (uaKeymap (cov nyees khawm), rowP, kab P, kab, kab, kab); // tsim cov keyboard
Servo tam sim noServo; // tsim cov khoom siv servo los tswj lub servo
// kaum ob yam khoom siv servo tuaj yeem tsim tau ntawm cov laug cam
int pos = 0; // sib txawv los khaws txoj haujlwm servo
void teeb tsa () {
Serial.begin (9600); currentServo.attach (3); // txuas cov servo ntawm tus pin 9 rau cov khoom siv servo
}
void voj () {
khawm khawm Pressed = pad.getKey (); // tau txais daim npav los ntawm cov keyboard yog tias (khawm Nyem) // qhia lub pob twg tau nyem rau ntawm lub keyboard {Serial.println (buttonPressed); }
currentServo.write (95);
}
Kauj Ruam 3: Hloov Kho Txoj Cai los Siv Cov Keypad ntawm Servo
Paub tias peb yuav hloov kho peb cov cai kom thaum peb nias lub pob tshwj xeeb ntawm cov keyboard, servo txav mus rau txoj haujlwm tshwj xeeb. Ib yam tseem ceeb ua ntej. Qhov chaw pabcuam servo rau 0 yog qhov txawv. Txij li thaum kuv muaj kev sib hloov ua haujlwm tas li, thaum twg nws tau ze rau 0, servo nyuam qhuav pib tig. Tus lej kuv muab tso rau hauv cov cai tau qis li kuv tuaj yeem mus yam tsis muaj qhov tshwm sim. Txawm li cas los xij, nov yog kuv tus lej kawg:
#ncig #ncig
const byte kab = 4; // plaub kab txij li cov keypad puv lawm
const byte txhua = 4; // plaub kab, tib yam li saum toj no
cov nyees khawm [kab] [kab ntawv] = {
{'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', ' C '}, {'*',' 0 ','#',' D '}};
byte rowP [kab] = {13, 12, 11, 10}; // kab pins ntawm tus keyboard
byte columnsP [kab ntawv] = {9, 8, 7, 6}; // kab pins ntawm tus keyboard
Keypad pad = Keypad (uaKeymap (cov nyees khawm), rowP, kab P, kab, kab, kab); // tsim cov keyboard
Servo myServo; //
void teeb tsa () {
Serial.begin (9600); myServo.attach (5); // txuas cov servo ntawm tus pin 9 rau cov khoom siv servo}
void voj () {
char tseem ceeb = pad.getKey (); // tau txais tus lej los ntawm cov keyboard yog (qhov tseem ceeb == '0') {myServo.write (11); Serial.println ("0"); ncua (15); } yog (qhov tseem ceeb == '1') {myServo.write (12); Serial.println ("1"); ncua (15); } yog (qhov tseem ceeb == '2') {myServo.write (24); Serial.println ("2"); ncua (15); } yog (qhov tseem ceeb == '3') {myServo.write (36); Serial.println ("3"); ncua (15); }
yog (qhov tseem ceeb == '4')
{myServo.write (48); Serial.println ("4"); ncua (15); }
yog (qhov tseem ceeb == '5')
{myServo.write (60); Serial.println ("5"); ncua (15); }
yog (qhov tseem ceeb == '6')
{myServo.write (72); Serial.println ("6"); ncua (15); }
yog (qhov tseem ceeb == '7')
{myServo.write (84); Serial.println ("7"); ncua (15); }
yog (qhov tseem ceeb == '8')
{myServo.write (96); Serial.println ("8"); ncua (15); }
yog (qhov tseem ceeb == '9')
{myServo.write (108); Serial.println ("9"); ncua (15); }
yog (qhov tseem ceeb == '*')
{myServo.write (120); Serial.println ("*"); ncua (15); }
yog (qhov tseem ceeb == '#')
{myServo.write (132); Serial.println ("#"); ncua (15); }
yog (qhov tseem ceeb == 'A')
{myServo.write (146); Serial.println ("A"); ncua (15); }
yog (qhov tseem ceeb == 'B')
{myServo.write (158); Serial.println ("B"); ncua (15); }
yog (qhov tseem ceeb == 'C')
{myServo.write (170); Serial.println ("C"); ncua (15); }
yog (qhov tseem ceeb == 'D')
{myServo.write (180); Serial.println ("D"); ncua (15); }}
Pom zoo:
Interfacing Keypad Nrog Arduino. [Txoj hauv kev tshwj xeeb]: 7 Kauj Ruam (nrog Duab)
Interfacing Keypad Nrog Arduino. [Txoj hauv kev tshwj xeeb]: Nyob zoo, thiab zoo siab tos txais kuv thawj qhov kev qhia! :) Hauv cov lus qhia no kuv xav qhia lub tsev qiv ntawv txaus rau cuam tshuam cov keyboard nrog arduino - 'Lub tsev qiv ntawv lo lus zais' suav nrog 'Lub Tsev Qiv Ntawv'. Lub tsev qiv ntawv no suav nrog cov yam ntxwv zoo tshaj plaws uas peb wi
4x4 Keypad Nrog Arduino thiab Ua: 4 Cov Kauj Ruam (nrog Duab)
4x4 Keypad Nrog Arduino thiab Ua Haujlwm: Tsis nyiam LCD cov lus? Xav ua kom koj cov phiaj xwm saib zoo li cas? Hauv Cov Lus Qhia no koj yuav tuaj yeem tso koj tus kheej los ntawm qhov teeb meem ntawm kev siv lub vijtsam LCD los tso saib cov ntsiab lus los ntawm koj li Arduino thiab tseem ua rau koj txoj haujlwm
Keypad Module Piano Nrog RGB LED: 5 Kauj Ruam (nrog Duab)
Keypad Module Piano Nrog RGB LED: IntroHello 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 keypad thiab piezo buzzer thiab nws muaj peev xwm ua si DO-RE-MI thiab ntxiv rau
Keypad Interface Nrog 8051 thiab Qhia Tus Xov Tooj Tus lej hauv 7 Segment: 4 Cov Kauj Ruam (nrog Duab)
Keypad Interface Nrog 8051 thiab Qhia Tus Xov Tooj Tus lej hauv 7 Segment: Hauv qhov kev qhia no kuv yuav qhia koj txog yuav ua li cas peb tuaj yeem cuam tshuam cov keyboard nrog 8051 thiab qhia cov lej lej hauv 7 ntu zaub
Interface 16x2 Alphanumeric LCD And4x4 Matrix Keypad Nrog Raspberry Pi3: 5 Cov Kauj Ruam (nrog Duab)
Interface 16x2 Alphanumeric LCD And4x4 Matrix Keypad Nrog Raspberry Pi3: Hauv cov lus qhia no, peb piav qhia yuav ua li cas cuam tshuam 16x2 LED thiab 4x4 matrix keypad nrog Raspberry Pi3. Peb siv Python 3.4 txhawm rau txhim kho software. Koj tuaj yeem xaiv Python 2.7 ib yam nkaus, nrog kev hloov me ntsis