Cov txheej txheem:

Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1: 5 Cov Kauj Ruam
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1: 5 Cov Kauj Ruam

Video: Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1: 5 Cov Kauj Ruam

Video: Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1: 5 Cov Kauj Ruam
Video: Arduino in 100 Seconds 2024, Kaum ib hlis
Anonim
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1
Nyeem ANALOG VOLTAGE - ARDUINO - CODE REVEAL #1

CODE REVEAL #1 nyeem ANALOG VOLTAGE: Qhov piv txwv no qhia koj yuav ua li cas nyeem cov lus sib piv ntawm tus lej pin 0, hloov tus nqi los ntawm analogRead () rau hauv qhov hluav taws xob, thiab luam tawm nws mus rau tus saib xyuas ntawm Arduino Software (IDE).

Kauj ruam 1: HARDWARE YUAV TSUM:

Arduino lossis Genuino Board, 10k OHM Potentiometer.

Kauj Ruam 2: Kev Nyab Xeeb Kev Nyab Xeeb; Kev noj qab nyob zoo:

Ceevfaj tias Lub Hwjchim Sab Nraud Pabcuam Siv ntawm ANALOG PIN ntawm ARDUINO yuav tsum tsis pub dhau 5V, vim tias ARDUINO ua haujlwm ntawm 5V LOGIC, thiab MICROCONTROLLER tuaj yeem hlawv tawm yog lub VOLTAGE nyob siab dua 5V. Txoj haujlwm no muaj txiaj ntsig zoo rau kev txheeb xyuas lub VOLTAGE ntawm tus cwj mem me me lossis LITHIUM BATTERIES THIAB TRIMPOTS.

Kauj Ruam 3: CIRCUIT:

CIRCUIT
CIRCUIT
CIRCUIT
CIRCUIT

Txuas peb lub xov hlau los ntawm lub hwj chim rau koj lub rooj tsavxwm. Thawj zaug mus rau hauv av los ntawm ib qho ntawm cov pins sab nraud ntawm lub zog. Qhov thib ob mus rau 5 volts los ntawm lwm tus pin sab nraud ntawm lub zog. Qhov thib peb mus los ntawm tus pin nruab nrab ntawm lub hwj chim rau cov tswv yim sib piv 0. Los ntawm kev tig lub taub hau ntawm lub hwj chim, koj hloov tus nqi tiv thaiv ntawm ob sab ntawm lub wiper uas txuas nrog rau tus pin nruab nrab ntawm lub hwj chim. Qhov no hloov qhov hluav taws xob ntawm tus pin nruab nrab. Thaum qhov tsis kam ntawm nruab nrab thiab sab txuas nrog 5 volts ze rau xoom (thiab qhov tsis kam ntawm lwm sab yog ze rau 10 kilohms), qhov hluav taws xob ntawm qhov chaw tus pin ze rau 5 volts. Thaum cov kev tawm tsam tau thim rov qab, qhov hluav taws xob ntawm qhov nruab nrab tus pin nyob ze 0 volts, lossis hauv av. Qhov ntsuas hluav taws xob no yog qhov ntsuas hluav taws xob sib piv uas koj tab tom nyeem ua lub tswv yim. Qhov microcontroller ntawm lub rooj tsavxwm muaj lub Circuit Court sab hauv hu ua analog-to-digital converter lossis ADC uas nyeem qhov kev hloov pauv no thiab hloov nws mus rau tus lej ntawm 0 thiab 1023. Thaum tus ncej tau tig mus rau txhua txoj hauv kev, muaj 0 volts mus rau tus pin, thiab tus nqi nkag yog 0. Thaum tus ncej tau tig txhua txoj hauv kev rov qab, muaj 5 volts mus rau tus pin thiab tus nqi nkag yog 1023. Hauv nruab nrab, analogRead () rov qab tus lej nruab nrab ntawm 0 thiab 1023 uas yog sib npaug rau qhov ntsuas qhov hluav taws xob tau thov rau tus pin.

Kauj ruam 4: CODE:

CODE
CODE

Txhawm rau sau tseg tias yog tias koj tsis muaj lub khoos phis tawj lossis lub khoos phis tawj, koj tuaj yeem tsim kho koj li Arduino nrog lub app 'Arduinodroid' muaj nyob hauv Google Play Store. Koj tuaj yeem mus ntsib tus saib xyuas nrog kev pab ntawm 'Arduinodroid'.void teeb tsa () {Serial.begin (9600);} void loop () {int sensorValue = analogRead (A0); ntab voltage = sensorValue * (5.0 / 1023.0); Serial.println (qhov hluav taws xob);}

Kauj ruam 5: Instagram Tshaj Tawm

Mus ntsib no Instagram tshaj tawm qhov twg kuv piav qhia qhov haujlwm no -

Pom zoo: