Cov txheej txheem:
- Kauj Ruam 1: Pulse Flow ntawm Rotary Encoder
- Kauj ruam 2: Pinout ntawm Teb Encoder
- Kauj ruam 3: Schematic
- Kauj ruam 4: Code
- Kauj ruam 5: Piav qhia
- Kauj Ruam 6: Tso Tawm
Video: Tutorial of Rotary Encoder Nrog Arduino: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
Rotary encoder yog cov khoom siv hluav taws xob muaj peev xwm saib xyuas kev txav chaw thiab txoj haujlwm thaum tig. Rotary encoder siv lub tshuab ntsuas qhov muag uas tuaj yeem tsim cov mem tes thaum lub tshuab ntsuas lub cav tig. Daim ntawv thov ntawm tus lej nkag teb chaws feem ntau yog siv tshuab lossis neeg hlau txav saib kuj tseem tuaj yeem siv rau kev xaiv zaub mov ntawm cov zaub. Rotary encoder muaj ob qhov kev tso tawm kom nws tuaj yeem paub qhov txawv ntawm qhov tsis zoo (CW) thiab qhov zoo (CCW) kev sib hloov thiab tseem muaj tib lub khawm.
Kauj Ruam 1: Pulse Flow ntawm Rotary Encoder
Cov mem tes ntws tsim los ntawm cov lus teb hauv qab no zoo li daim duab saum toj no.
Kauj ruam 2: Pinout ntawm Teb Encoder
Piav qhia:
- GND GND
- + + 5V
- SW khawm ntawm cov teb encoder thaum nias
- Cov ntaub ntawv DT
- Cov ntaub ntawv CLK 2
Ib qho ntawm DT lossis CLK tus pin yuav tsum txuas nrog kev cuam tshuam taw ntawm Arduino Uno, lossis ob qho tib si ntawm DT thiab CLK txuas nrog tus pin cuam tshuam.
Kauj ruam 3: Schematic
- GND thiab GND Arduino Uno
- + à + 5V Arduino Uno
- SW -PIN 4 Arduino Uno
- DT -PIN 3 Arduino Uno
- CLK à PIN2 Arduino Uno
Kauj ruam 4: Code
Hauv cov lus qhia hauv qab no, uas yuav raug siv los cuam tshuam yog PIN 2 ntawm Arduino Uno, thaum tus lej 3 tsuas yog siv los ua ntu zus xwb.
#define encoder0PinA 2 #txhais encoder0PinB 3 #define encoder0Btn 4 int encoder0Pos = 0; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); pinMode (encoder0PinA, INPUT_PULLUP); pinMode (encoder0PinB, INPUT_PULLUP); pinMode (encoder0Btn, INPUT_PULLUP); attachInterrupt (0, doEncoder, CHANGE); } int valRotary, kawgValRotary; lub voj void () {int btn = digitalRead (encoder0Btn); Serial.print (btn); Serial.print (""); Serial.print (valRotary); yog (valRotary> lastValRotary) {Serial.print ("CW"); } yog (valRotary {
Serial.print ("CCW");
} lastValRotary = valRotary; Serial.println (""); ncua (250); } void doEncoder () {if (digitalRead (encoder0PinA) == digitalRead (encoder0PinB)) {encoder0Pos ++; } lwm {encoder0Pos--; } valRotary = encoder0Pos/2.5; }
Hauv kab 10 ntawm daim duab kos saum toj no tau siv los pab cuam tshuam ntawm tus pin 2 Arduino Uno. Hauv qhov "doEncoder" muaj nuj nqi yog xam los ntawm cov teb encoder. Yog tias tus nqi ntawm DT thiab CLK (tus pin cuam tshuam ntawm Arduino Uno) zoo ib yam, tom qab ntawd qhov "encoder0Pos" qhov sib txawv yuav nce ntxiv / ntxiv, ntxiv rau qhov xwm txheej ntawd, "encoder0Pos" qhov sib txawv tau txo qis.
Kauj ruam 5: Piav qhia
Tus nqi ValRotary yog tus nqi ntawm cov lej uas tau ua tiav. ValRotary tus nqi tau txais los ntawm kev ntsuas lub ntsuas qhov ntsuas ntsuas sib faib los ntawm 2.5. Tus nqi ntawm 2.5 tau txais los ntawm qhov kev sim, txij li ib qib ntawm tus lej nkag teb chaws tuaj yeem siab dua 1, yog li faib los ntawm 2.5 rau nws tus nqi raws li qhov nkag mus thiab tseem ntxiv qhov nyeem qeeb.
Thaum nyob ntawm kab 19 - 25 yog txoj haujlwm los txiav txim siab seb lub teb chaws rotary encoder CW lossis CCW. Cov lus piav qhia ntawm kab 19 - 25 yog thaum qhov kev nyeem ntawv nkag teb chaws tam sim no ntau dua li cov ntaub ntawv teb yav dhau los ces tau hais tawm raws li CW. Whereas yog tias kev nyeem ntawv tam sim no me dua li nyeem yav dhau los ces nws tau hais raws li CCW.
Kauj Ruam 6: Tso Tawm
1 = pib khawm tus nqi ntawm cov teb thaum nws tsis tau nias
Pom zoo:
Timer Nrog Arduino thiab Rotary Encoder: 5 Kauj Ruam
Timer Nrog Arduino thiab Rotary Encoder: Lub timer yog cov cuab yeej siv feem ntau hauv kev lag luam thiab tsev neeg cov haujlwm no. Muaj ntau txoj haujlwm sau los ntawm kuv, rau Ardui
Lub Hwj Chim Timer Nrog Arduino thiab Rotary Encoder: 7 Cov Kauj Ruam (nrog Duab)
Lub Hwj Chim Timer Nrog Arduino thiab Rotary Encoder: Lub Hwj Chim Timer no yog ua raws lub sij hawm nthuav qhia ntawm: https: //www.instructables.com/id/Timer-With-Arduin…A lub zog muab khoom siv thiab SSR (lub xeev muaj zog xa tawm) ) tau txuas nrog nws.Ua haujlwm hnyav txog li 1KW tuaj yeem ua haujlwm thiab nrog kev hloov pauv me me
Rotary Encoder: Nws Ua Haujlwm Li Cas thiab Yuav Siv Li Cas Nrog Arduino: 7 Cov Kauj Ruam
Rotary Encoder: Nws Ua Haujlwm Li Cas thiab Yuav Siv Li Cas Nrog Arduino: Koj tuaj yeem nyeem qhov no thiab lwm yam kev qhia zoo ntawm ElectroPeak lub vev xaib raug cai Ua ntej, koj yuav pom qee cov ntaub ntawv hais txog kev hloov pauv tus lej, thiab tom qab ntawd koj yuav kawm paub yuav ua li cas
Rotary Encoder Nrog STM32 Nucleo Board: 12 Cov Kauj Ruam
Rotary Encoder Nrog STM32 Nucleo Board: Nov yog Tutorial rau Tau txais txoj haujlwm ntawm Rotary Encoder, uas yog hom ntxiv ntawm encoder.Encoders yog ob hom feem ntau:- ib qho yog nce ntxiv lwm qhov yog qhov tseeb. Cov lej no tuaj yeem siv rau STM32L476 thiab STM32L0 microcontrollers Tab sis yog tias koj h
Arduino Ntawv Qhia zaub mov ntawm Nokia 5110 Lcd Siv Lub Tshuab Rotary Encoder: 6 Cov Kauj Ruam (nrog Duab)
Arduino Cov Ntawv Qhia ntawm Nokia 5110 Lcd Siv Lub Tshuab Rotary Encoder: Nyob zoo cov phooj ywg zoo siab txais tos rau lwm qhov kev qhia! Hauv daim vis dis aus no peb yuav kawm paub tsim peb cov ntawv qhia zaub mov li cas rau Nokia 5110 LCD zaub uas nrov, txhawm rau ua kom peb cov phiaj xwm siv cov phooj ywg zoo thiab muaj peev xwm ntau dua. Cia ’ s pib! Qhov no yog txoj haujlwm