Cov txheej txheem:
- Kauj ruam 1:
- Kauj ruam 2:
- Kauj ruam 3:
- Kauj ruam 4:
- Kauj ruam 5:
- Kauj Ruam 6:
- Kauj Ruam 7: Ntau Hloov
- Kauj ruam 8:
- Kauj ruam 9:
Video: Arduino thiab Thumbwheel Hloov: 9 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Hauv kab lus no peb tshuaj xyuas kev siv lub laub-log/tus ntiv tes xoo hloov pauv nrog peb cov tshuab Arduino. Nov yog qee qhov piv txwv los ntawm PMD Txoj Kev.
Kauj ruam 1:
Rau qhov tsis tau pib, txhua qhov hloov pauv yog ib ntu ntu thiab lawv tuaj yeem txuas nrog ua ke los tsim ntau qhov ntau thiab tsawg. Koj tuaj yeem siv cov nyees khawm xaiv los ntawm tus lej xoom mus txog rau cuaj. Muaj lwm txoj hauv kev uas muaj lub log koj tuaj yeem txav nrog koj tus ntiv tes xoo tsis txhob nce/nqis khawm.
Ua ntej hnub ntawm kev zoo nkauj cov neeg siv cuam tshuam cov kev hloov no tau nrov heev cov txheej txheem rau teeb tsa cov lej nkag. Txawm li cas los xij lawv tseem muaj hnub no, yog li cia saib seb lawv ua haujlwm li cas thiab peb tuaj yeem siv lawv li cas. Qhov hloov pauv tus nqi tau ua los ntawm binary-coded decimal lossis decimal ncaj. Xav txog sab nraum qab ntawm qhov hloov pauv hauv daim ntawv BCD.
Kauj ruam 2:
Peb muaj ntau nyob rau sab laug, tom qab ntawv hu rau 1, 2, 4 thiab 8. Yog tias koj siv qhov hluav taws xob me me (hais 5V) rau qhov ib txwm muaj, tus nqi ntawm qhov hloov pauv tuaj yeem ntsuas los ntawm kev ntxiv cov txiaj ntsig ntawm cov neeg sib tham uas nyob hauv Xeev siab. Piv txwv li, yog tias koj xaiv 3 - kev sib cuag 1 thiab 2 yuav nyob ntawm qhov hluav taws xob ib txwm muaj. Qhov tseem ceeb ntawm xoom thiab cuaj tuaj yeem sawv cev zoo li hauv cov lus.
Kauj ruam 3:
Txog tam sim no koj yuav tsum paub tias nws yuav yooj yim nyeem tus nqi ntawm kev hloov pauv - thiab koj hais yog lawm, nws yog. Peb tuaj yeem txuas 5V rau qhov ib txwm muaj, cov txiaj ntsig rau cov lej nkag ntawm peb cov laug cam Arduino, tom qab ntawd siv digitalRead () los txiav txim siab tus nqi ntawm txhua qhov tso tawm. Hauv daim duab peb siv qee qhov lej ua piv txwv los hloov tus nqi BCD mus rau tus lej lej. Yog li cia peb ua tam sim no.
Los ntawm kev kho vajtse pom, peb yuav tsum tau coj mus rau hauv tus account ib yam ntxiv-lub laub-log hloov coj ua hluav taws xob zoo li plaub ib txwm qhib-khawm thawb. Qhov no txhais tau tias peb yuav tsum siv rub tawm cov neeg tawm tsam kom muaj qhov sib txawv ntawm cov xeev siab thiab qis. Yog li cov txheej txheem rau ib qho kev hloov pauv yog raws li tau hais los saum no.
Kauj ruam 4:
Tam sim no nws yog qhov teeb meem yooj yim los txuas cov txiaj ntsig tau sau npe 1, 2, 4, thiab 8 rau (piv txwv) cov koob digital 8, 9, 10 thiab 11. Txuas 5V rau qhov hloov pauv 'C' taw tes, thiab GND rau … GND. Tom ntej no, peb yuav tsum muaj daim duab kos uas tuaj yeem nyeem cov tswv yim thiab hloov pauv BCD cov zis mus rau zauv. Xav txog cov duab kos hauv qab no:
/ * Siv SAA1064 cov lej thaiv cov lej https://www.gravitech.us/7segmentshield.html Siv cov lej saib yog tias koj tsis muaj SAA1064 daim thaiv */ #suav nrog "Wire.h" #define q1 8 #define q2 9 # txhais q4 10 #define q8 11 tsis muaj teeb meem teeb tsa () {Serial.begin (9600); Hlau.begin (); // koom nrog i2c npav (chaw nyob yeem rau tus tswv) ncua (500); pinMode (q1, INPUT); // thumbwheel '1' pinMode (q2, INPUT); // thumbwheel '2' pinMode (q4, INPUT); // thumbwheel '4' pinMode (q8, INPUT); // thumbwheel '8'} tsis muaj dab tsi dispSAA1064 (suav suav) // xa tus lej suav rau Gravitech SAA1064 daim thaiv {const int lookup [10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F 0x6f; ib. int Txhiab, Ntau pua, Kaum, Hauv Paus; Wire.beginTransmission (0x38); Hlau.write (0); Hlau.write (B01000111); Wire.endTransmission (); Wire.beginTransmission (0x38); Hlau.write (1); Txhiab = Suav/1000; Pua pua = (Suav- (Txhiab*1000))/100; Kaum = (Suav-(Ntau txhiab*1000)+(Ntau pua*100)))/10; Base = Suav-((Txhiab*1000))+(Ntau pua*100)+(Kaum*10)); Wire.write (nrhiav [Base]); Wire.write (nrhiav [Kaum tawm]); Wire.write (nrhiav [Ntau pua]); Wire.write (nrhiav [Ntau txhiab]); Wire.endTransmission (); ncua (10); } int readSwitch () {int tag nrho = 0; yog (digitalRead (q1) == HIGH) {tag nrho+= 1; } yog (digitalRead (q2) == HIGH) {tag nrho+= 2; } yog (digitalRead (q4) == HIGH) {tag nrho+= 4; } yog (digitalRead (q8) == HIGH) {tag nrho+= 8; } xa tag nrho; } tsis muaj dab tsi voj () {dispSAA1064 (readSwitch ()); // xa tus nqi hloov mus tso saib daim thaiv Serial.println (readSwitch ()); // xa tus nqi hloov mus rau lub thawv saib txuas}
Kev ua haujlwm readSwitch () yog tus yuam sij. Nws suav tus nqi ntawm qhov hloov pauv los ntawm kev ntxiv cov lej sawv cev ntawm txhua qhov kev hloov pauv thiab xa rov qab tag nrho raws li nws qhov tshwm sim. Txog qhov piv txwv no peb tau siv daim ntawv tso saib zauv uas yog tswj los ntawm NXP SAA1064.
Kauj ruam 5:
Kev ua haujlwm readSwitch () yog tus yuam sij. Nws suav tus nqi ntawm qhov hloov pauv los ntawm kev ntxiv cov lej sawv cev ntawm txhua qhov kev hloov pauv thiab xa rov qab tag nrho raws li nws qhov tshwm sim. Txog qhov piv txwv no peb tau siv daim ntawv tso saib zauv uas yog tswj los ntawm NXP SAA1064.
Yog tias koj tsis muaj ib qho, uas tsis ua li cas - cov txiaj ntsig tseem raug xa mus rau tus saib xyuas. Tam sim no, cia saib nws hauv kev nqis tes ua hauv video.
Kauj Ruam 6:
Ok nws tsis zoo li ntau, tab sis yog tias koj xav tau tus lej nkag nws txuag ntau qhov chaw ntawm lub cev thiab muab txoj hauv kev nkag ncaj qha.
Yog li ntawd koj muaj nws. Koj puas yuav siv cov no hauv ib qhov haujlwm? Rau ib tus lej - yog. Rau plaub? Tej zaum tsis yog-tej zaum nws yuav yooj yim dua siv tus lej 12 tus lej. Muaj ib lub tswv yim …
Kauj Ruam 7: Ntau Hloov
Tam sim no peb yuav tshuaj xyuas yuav ua li cas nyeem plaub tus lej - thiab tsis pov tseg tag nrho cov pins digital hauv tus txheej txheem. Hloov chaw, peb yuav siv Microchip MCP23017 16-ntsis chaw nres nkoj nthuav dav IC uas sib txuas lus ntawm I2C npav. Nws muaj kaum rau digital cov tswv yim/tso tawm pins uas peb tuaj yeem siv los nyeem cov xwm txheej ntawm txhua qhov hloov pauv.
Ua ntej yuav mus tom ntej, thov nco ntsoov tias qee qhov kev xav tau xav tau rau kab lus no - I2C npav (ntu ib thiab ob) thiab MCP23017. Peb xub yuav piav qhia txog kev kho vajtse sib txuas, thiab tom qab ntawd kos duab Arduino. Nco qab cov schematic siv rau ib qho piv txwv piv txwv.
Thaum qhov hloov pauv tau txuas ncaj qha rau Arduino, peb nyeem cov xwm txheej ntawm txhua tus pin txhawm rau txiav txim siab tus nqi ntawm qhov hloov pauv. Peb yuav ua qhov no dua, ntawm qhov loj dua siv MCP23017. Xav txog daim duab pinout:
Kauj ruam 8:
Peb muaj 16 tus pin, uas tso cai rau plaub qhov txuas txuas. Cov lus sib txuas rau txhua qhov kev hloov pauv tseem txuas rau 5V, thiab txhua qhov kev sib txuas sib txuas tseem muaj 10k rub-down resistor rau GND. Tom qab ntawd peb txuas 1, 2, 4, 8 tus lej ntawm tus lej rau GPBA0 ~ 3; lej ob tus 1, 2, 4, 8 rau GPA4 ~ 7; lej peb tus 1, 2, 4, 8 rau GPB0 ~ 3 thiab tus lej plaub tus 1, 2, 4, 8 rau GPB4 ~ 7.
Tam sim no peb nyeem cov hloov pauv li cas? Tag nrho cov xov hlau no yuav ua rau koj xav tias nws nyuaj, tab sis daim duab kos yog yooj yim heev. Thaum peb nyeem tus nqi ntawm GPBA thiab B, ib byte raug xa rov qab rau txhua lub txhab nyiaj, nrog qhov tseem ceeb tshaj plaws me ntsis ua ntej. Txhua plaub qhov me me yuav sib phim qhov teeb tsa ntawm qhov hloov pauv txuas rau qhov sib piv I/O pins. Piv txwv li, yog tias peb thov cov ntaub ntawv rau ob lub txhab nyiaj IO thiab cov hloov pauv tau teeb tsa rau 1 2 3 4 - lub txhab nyiaj A yuav rov qab 0010 0001 thiab lub txhab nyiaj B yuav rov qab los 0100 0011.
Peb siv qee qhov haujlwm me me los cais txhua plaub qhov me me rau hauv qhov sib txawv sib txawv - uas tawm peb nrog tus nqi ntawm txhua tus lej. Piv txwv, kom cais tus nqi ntawm hloov plaub, peb hloov cov khoom los ntawm txhab nyiaj B >> 4. Qhov no thawb tus nqi ntawm kev hloov peb tawm, thiab cov khoom seem ntawm sab laug dhau los ua xoom.
Txhawm rau cais tus nqi rau hloov peb, peb siv cov sib xyaw me ntsis & - uas tawm qhov txiaj ntsig ntawm hloov peb. Cov duab qhia pom kev sib cais ntawm qhov hloov pauv binary - nws qhia qhov nyoos GPIOA thiab B byte qhov tseem ceeb, tom qab ntawd txhua tus lej tus lej binary, thiab tus lej zauv.
Kauj ruam 9:
Yog li cia peb pom qhov kev qhia ua piv txwv:
/ * Piv txwv 40a-Nyeem plaub lub pushwheel BCD hloov ntawm MCP23017, tso rau ntawm SAA1064/4-digit 7-segment LED zaub */// MCP23017 pins 15 ~ 17 rau GND, I2C chaw nyob npav yog 0x20 // SAA1064 I2C npav chaw nyob 0x38 # suav nrog "Wire.h" // rau cov lej txhais ntawm tus lej hauv tus lej [16] = {63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 119, 124, 57, 94, 121, 113 }; byte GPIOA, GPIOB, dig1, dig2, dig3, dig4; void initSAA1064 () {// teeb tsa 0x38 Wire.beginTransmission (0x38); Hlau.write (0); Hlau.write (B01000111); // 12mA tso tawm, tsis muaj tus lej blanking Wire.endTransmission (); } void teeb () {Serial.begin (9600); Hlau.begin (); // pib I2C tsheb npav initSAA1064 (); } void loop () {// nyeem cov tswv yim ntawm txhab nyiaj A Wire.beginTransmission (0x20); Hlau.write (0x12); Wire.endTransmission (); Wire.requestFrom (0x20, 1); GPIOA = Hlau.read (); // qhov byte no muaj cov ntaub ntawv hloov pauv rau tus lej 1 thiab 2 // nyeem cov tswv yim ntawm txhab nyiaj B Wire.beginTransmission (0x20); Hlau.write (0x13); Wire.endTransmission (); Wire.requestFrom (0x20, 1); GPIOB = Wire.read (); // qhov byte no muaj cov ntaub ntawv hloov pauv rau tus lej 3 thiab 4 // rho tus nqi rau txhua qhov hloov pauv // dig1 LHS, dig4 RHS dig4 = GPIOB >> 4; dig3 = GPIOB & B00001111; dig2 = GPIOA >> 4; dig1 = GPIOA & B00001111; // xa tag nrho GPIO thiab tus kheej hloov cov ntaub ntawv mus rau tus lej saib // rau kev debug thiab kev txaus siab lub hom phiaj Serial.print ("GPIOA ="); Serial.println (GPIOA, BIN); Serial.print ("GPIOB ="); Serial.println (GPIOB, BIN); Serial.println (); Serial.print ("tus lej 1 ="); Serial.println (dig1, BIN); Serial.print ("tus lej 2 ="); Serial.println (dig2, BIN); Serial.print ("tus lej 3 ="); Serial.println (dig3, BIN); Serial.print ("tus lej 4 ="); Serial.println (dig4, BIN); Serial.println (); Serial.print ("tus lej 1 ="); Serial.println (dig1, DEC); Serial.print ("tus lej 2 ="); Serial.println (dig2, DEC); Serial.print ("tus lej 3 ="); Serial.println (dig3, DEC); Serial.print ("tus lej 4 ="); Serial.println (dig4, DEC); Serial.println (); // xa tus nqi hloov mus rau LED zaub ntawm SAA1064 Wire.beginTransmission (0x38); Hlau.write (1); Wire.write (tus lej [dig4]); Wire.write (tus lej [dig3]); Wire.write (tus lej [dig2]); Wire.write (tus lej [dig1]); Wire.endTransmission (); ncua (10); ncua (1000); }
Thiab rau cov neeg tsis ntseeg… ua yeeb yaj kiab video.
Yog li ntawd koj muaj nws. Plaub tus lej tsis yog ib qho, thiab dhau ntawm I2C tsheb npav khaws cia Arduino digital I/O pins. Siv yim MCP23017s koj tuaj yeem nyeem 32 tus lej ib zaug. Muaj kev lom zem nrog ua qhov ntawd!
Koj tuaj yeem xaj ob qho BCD thiab cov lej sib hloov hauv ntau qhov ntau los ntawm PMD Txoj Kev, nrog kev xa khoom dawb thoob ntiaj teb.
Cov ntawv tshaj tawm no tau coj tuaj rau koj los ntawm pmdway.com - txhua yam rau cov kws tsim khoom thiab cov khoom siv hluav taws xob, nrog kev xa khoom dawb thoob ntiaj teb.
Pom zoo:
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Ua Si Cov Khoom Ua Si Ua Tau Zoo!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Siv Hluav Taws Xob Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Tuchless Hloov rau Cov Khoom Siv Hauv Tsev -- Tswj Koj Cov Khoom Siv Hauv Tsev Tsis Muaj Tuch Ib qho Hloov: 4 Cov Kauj Ruam
Tuchless Hloov rau Cov Khoom Siv Hauv Tsev || Tswj Koj Cov Khoom Siv Hauv Tsev Tsis Muaj Tuch Ib qho Hloov: Nov Yog Qhov Tuchless Hloov Rau Cov Khoom Siv Hauv Tsev. Koj Siv Tau Qhov No Mus Rau Txhua Qhov Chaw Hauv Pej Xeem Kom Pab Tau Tawm Tsam Ib Yam Kab Mob. Lub Circuit Court Raws Li Tsaus Sensor Circuit Ua Los Ntawm Op-Amp Thiab LDR. Qhov Tseem Ceeb Thib Ob Ntawm Qhov Circuit Court SR Flip-Flop Nrog Sequencell
Kev hloov kho Servo rau 360 ° Kev Sib Hloov thiab Cov Tsav Tsheb: 4 Cov Kauj Ruam
Kev hloov kho Servo rau 360 ° Kev Sib Hloov thiab Lub Cev Muaj Zog: hauv cov lus qhia no kuv yuav qhia koj yuav hloov kho li cas 9g servo rau 360 tig. Qhov no yog qhov muaj txiaj ntsig zoo yog tias koj tab tom npaj ua lub rover me me nrog kev siv tsawg kawg ntawm gpio ntawm microcontroller. kuj yog tias koj muaj qee qhov kev puas tsuaj servo koj tuaj yeem hloov cov se
Hloov-Hloov Cov Khoom Ua Si: Qes Chaw Taws Teeb Tswj Cov Nab Ua Tau!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Qes Chaw Taws Teeb Tswj Cov Nab Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Txhim Kho Cov Hloov Pauv Hloov Rau Hauv Ntse Kov Hloov Nrog Temp Monitoring: 4 Cov Kauj Ruam
Txhim Kho Qhov Hloov Pauv Hloov Mus Rau Ntse Kov Hloov Nrog Lub Sijhawm Saib Xyuas: Kuv paub txhua tus ntawm koj ntsib qhov teeb meem no tsawg kawg ib qho hauv koj lub neej lub rooj hloov pauv tau tawg los ntawm kev siv tas mus li. ntau lub sijhawm yog lub caij nplooj ntoo hlav sab hauv hloov pauv los yog m