Cov txheej txheem:

Fading/Tswj Led/ci ntsa iab Siv Potentiometer (Variable Resistor) thiab Arduino Uno: 3 Cov Kauj Ruam
Fading/Tswj Led/ci ntsa iab Siv Potentiometer (Variable Resistor) thiab Arduino Uno: 3 Cov Kauj Ruam

Video: Fading/Tswj Led/ci ntsa iab Siv Potentiometer (Variable Resistor) thiab Arduino Uno: 3 Cov Kauj Ruam

Video: Fading/Tswj Led/ci ntsa iab Siv Potentiometer (Variable Resistor) thiab Arduino Uno: 3 Cov Kauj Ruam
Video: Qhov Sawv thiab Qhov Poob ntawm Haiv Neeg Loos Lub Teb Chaws (Cov Ntsiab Lus Tseem Ceeb) 2024, Kaum ib hlis
Anonim
Image
Image
Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau

Arduino analog input pin txuas nrog rau qhov tso zis ntawm potentiometer. Yog li Arduino ADC (analog to digital converter) analog pin tau nyeem qhov hluav taws xob tso tawm los ntawm lub hwj chim. Kev tig lub pob qhov rooj potentiometer sib txawv qhov hluav taws xob tso tawm thiab Arduino nyeem qhov kev hloov pauv no. Arduino hloov pauv qhov hluav taws xob nkag mus rau nws tus pin analog rau hauv daim ntawv digital. Tus nqi digital yog los ntawm 0 txog 1023 volts. 0 sawv cev rau 0 volts thiab 1023 sawv cev rau 5 volts. Arduino ADC yog 10 ntsis uas txhais tau tias nws ua piv txwv cov qauv siv hluav taws xob thiab tso nws tawm ntawm qhov nruab nrab ntawm 0 txog 1023 volts (2^10 = 1024). Arduino ua haujlwm ntawm 5 volts yog li nws ADC cov khoom siv hluav taws xob ntau kuj tseem nyob nruab nrab ntawm 0 txog 5 volts. Arduino boards ua haujlwm ntawm 3 volts input ntau rau ADC yog 0 txog 3 volts.

Nco tseg: Thov siv qhov hluav taws xob ntau dua rau Arduino analog pins yuav ua rau koj pawg Arduino puas tsuaj. Yog li hauv peb qhov xwm txheej, lub zog hluav taws xob tso tawm hluav taws xob yuav tsum tsis txhob nce 5 volts

Kauj Ruam 1: Cov Cheeb Tsam Yuav Tsum Tau:

Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau

1. Arduino Uno

2. Cov qhob cij

3. Potentiometer (10k)

4. Coj

5. Resistor

6. Jumper xov hlau

Kauj Ruam 2: Daim Duab Circuit:

Image
Image

Lub zog hluav taws xob tau siv hauv cov kab hluav taws xob uas peb xav tau qhov sib txawv tsis kam los tswj tam sim no thiab qhov hluav taws xob. Koj puas tau pom tias tus neeg hais lus uas koj muaj hauv koj lub tsev, koj txav nws lub pob qhov rooj raws lub moos thiab cov lus qhia rov qab los rau lub sijhawm kom teeb tsa lub ntim. Qhov tseeb, tom qab pob qhov rooj, muaj lub zog ntsuas, uas yog koj tab tom hloov qhov tsis kam los teeb lub ntim. Zoo ib yam hauv ntau lwm yam khoom siv hauv tsev potentiometer siv rau tib lub hom phiaj (TV qub, xov tooj cua qub thiab lwm yam).

Yog tias peb txuas ncaj qha coj nrog lub zog ntsuas peb tuaj yeem ploj/tswj qhov ci ntawm coj tab sis tsis raug thiab yog tias peb ntxig thiab nruab nrab microcontroller tom qab ntawd microcontroller tuaj yeem ploj coj nrog qib ci ci peb xav tau. Hauv kev tswj hwm qhov ci ncaj qha nyob ntawm qhov tsis kam ntawm lub hwj chim tab sis nrog lub microcontroller nyob nruab nrab ntawm qhov ci ci nyob ntawm qhov hluav taws xob tso tawm ntawm lub hwj chim thiab qee yam peb tuaj yeem tsis quav ntsej qhov hluav taws xob tso tawm thiab tswj ntawm peb cov kev ntsuas tsis tau txhais. Nrog lub microcontroller, muaj kev hloov pauv ntau dua li kev ua kom ploj mus.

Kauj ruam 3: Code:

Yog xav paub ntau cov phiaj xwm txuas nrog kuv ntawm:

Youtube: https://www.youtube.com/channel/UCTS10_CRYJhT-vb9 … Facebook nplooj:

Instagram:

void teeb tsa ()

{Serial.begin (9600); pinMode (5, NTAWV); pinMode (3, INPUT); } void loop () {int ib = analogRead (A0); int ib = a/4; Serial.println (b); analogWrite (5, b); ncua (200);

}

Pom zoo: