Laboratoriya ishi № Potensiometr. Laboratoriya ishining maqsadi


LABORATORIYA UCHUN TOPSHIRIQLAR



Download 1,46 Mb.
bet4/10
Sana09.06.2022
Hajmi1,46 Mb.
#646614
1   2   3   4   5   6   7   8   9   10
Bog'liq
2- dedline7-12 gacha

LABORATORIYA UCHUN TOPSHIRIQLAR
6. Potensiometr orqali LED yorug’ligini (yorug’ va qorong’u) nazorat qiling qiymatini outputValue = map(sensorValue, 0, 1023, 0, 255); haqida ma’lumot keltiring.

Dasturiy qismi:


// C++ code
//
/*
Analog input, analog output, serial output


Reads an analog input pin, maps the result to a
range from 0 to 255 and uses the result to set
the pulsewidth modulation (PWM) of an output
pin. Also prints the results to the serial
monitor.


The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the
analog pin. side pins of the potentiometer go
to +5V and ground
* LED connected from digital pin 9 to ground


created 29 Dec. 2008
modified 9 Apr 2012
by Tom Igoe


This example code is in the public domain.
*/


int sensorValue = 0;


int outputValue = 0;


void setup()
{
pinMode(A0, INPUT);
pinMode(9, OUTPUT);
Serial.begin(9600);
}


void loop()
{
// read the analog in value:
sensorValue = analogRead(A0);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(9, outputValue);
// print the results to the serial monitor:
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
// wait 2 milliseconds before the next loop for the
// analog-to-digital converter to settle after the
// last reading:
delay(2); // Wait for 2 millisecond(s)
}

Download 1,46 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish