Laboratoriya ishi № Pezonurlatgich.(Buzzer musiqa notasi). Pezonurlatgich(Buzzer) datchigini boshqarish: tonni o‘zgartirish. Transtistor xususiyatini namoyish etish. Elektrorichak misolida aylanish o‘zgartirish
Download 0.71 Mb.
|
Laboratoriya ishi-5-6 (1)(1)
56-rasm. DHT 22 Ulanish sxemasi.
#include "DHT.h" #define DHTPIN 2 #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(115200); Serial.println(F("DHT22 example!")); dht.begin(); } void loop() { float temperature = dht.readTemperature(); float humidity = dht.readHumidity(); // Check if any reads failed and exit early (to try again). if (isnan(temperature) || isnan(humidity)) { Serial.println(F("Failed to read from DHT sensor!")); return; } Serial.print(F("Humidity: ")); Serial.print(humidity); Serial.print(F("% Temperature: ")); Serial.print(temperature); Serial.println(F("°C ")); // Wait a few seconds between measurements. delay(2000); } DHT22 (AM2302) termo-va-issyqlik datchisi juda yuqori qulaylik va to‘g‘ri ishlashga ega bo‘lsa ham, uning bir nechta kamchiliklari mavjud bo‘lishi mumkin. Quyidagi kamchiliklarni eslatibo‘tamiz: Javob uzatish va narxi: DHT22-nio‘qish uchun kamchiliklardan biri,o‘qish uchun javob uzatishi vaqtinchalik bo‘lishi mumkin. Buning natijasida Arduino va boshqa mikrokontrollerlar bir oz davom etishi mumkin. Datchio‘qish jarayonida keyinchalik kamchiliklar nazariga olinishi mumkin, bu esa natijalarning kech bo‘lishiga olib kelishi mumkin. o‘lchov chiqarilishi: DHT22 modulidan olingan harorat va issiqlik qiymatlari to‘g‘ri bo‘lmasligi mumkin. Ushbu xatoliklarni kompensatsiya qilish oson emas.o‘zlaringizning tajribangizga qarab, modulni to‘g‘ri qilib qo‘yish yoki kalibratsiya qilish lozim bo‘lishi mumkin. Tajriba haqida bo‘lmagan: DHT22 datchisio‘sish va pasayishlar orqali yorqin ishlovchi joylarda qo‘llanishiga yo‘l qo‘ymaydi. Har qanday toza,o‘roq va havoni sirkulyatsiyalab turib, ma'lum bir masofada joylashtirish talab etiladi. Tez vaqto‘tkazish: Datchio‘qish davomida tez vaqto‘tkazishlar ro‘y berishi mumkin, chunku datchi shaffof (sensorni eshitmas) va tezo‘tkazishlarga xotin reaksiya berishi mumkin. Batafsil monitoring uchun yetersiz: DHT22 datchisi kuchli monitoring va monitoring loyihalariga qo‘shish uchun mos keladi, lekin tezkor monitoring yoki bo‘ysundiq sohalarda (masalan, ushbu moduldan har 1-2 soniyada ma'lumot olishni istagan sohalar) tavsiya etilmaydi. Agar DHT22 modulining bu kamchiliklari sizning loyihangizning talablariga mos kelmasa, boshqa termo-va-issyqlik datchilarni, masalan, DS18B20 va BMP180 kabi datchilarni ko‘rib chiqishingiz mumkin. Bu datchilar ham to‘g‘ri ishlovchi va yuqori qulaylikka ega bo‘lishi mumkin. // * Caterina's Fur Elise on Arduino // * Original Composition : Für Elise // * Composed by : Ludwig van Beethoven // * Coded By GitHub User @spara - https://gist.github.com/spara/1832855 // * Use BSD Clause 2 License for Distribution // * Collection by GitHub User @abhishekghosh - https://github.com/AbhishekGhosh/Arduino-Buzzer-Tone-Codes void setup() { pinMode(10, OUTPUT); } void loop() { // play e4 delay(600); tone(10, 329.63, 300); delay(350); // play d4# tone(10, 311.13, 300); delay(350); // play e4 tone( 10, 329.63, 300); delay(350); // play d4# tone( 10,311.13, 300); delay(350); // play e4 tone(10, 329.63, 300); delay(350); // play b3 tone( 10, 246.94, 300); delay(400); // play d4 tone(10, 293.66,300); delay(400); // play c4 tone(10, 261.63,300); delay(400); // play a3 tone(10, 220, 900); delay(1000); // play d3 tone(10,146.83, 300); delay(350); //play f3 tone(10, 174.61, 300); delay(400); //play a3 tone(10, 220, 300); delay(400); // play b3 tone(10, 246.94, 900); delay(1000); // play f3 tone(10, 174.61, 300); delay(400); // play a3# tone(10, 233.08, 300); delay(400); // play b3 tone(10, 246.94, 300); delay(400); // play c4 tone(10, 261.63, 900); delay(1000); delay(300); // play e4 tone(10, 329.63, 300); delay(400); // play d4# tone(10, 311.13, 300); delay(400); // play e4 tone(10, 329.63, 300); delay(400); // play d4# tone(10, 311.13, 300); delay(400); // play e4 tone(10, 329.63, 300); delay(400); // play b3 tone(10, 246.94, 300); delay(400); // play d4 tone(10, 293.66, 300); delay(400); // play c4 tone(10, 261.63, 300); delay(400); // play a3 tone(10, 220, 900); delay(1000); // play d3 tone(10, 146.83, 300); delay(400); // play f3 tone(10, 174.61, 300); delay(400); // play a3 tone(10, 220, 300); delay(400); // play b3 tone(10, 246.94, 900); delay(1000); // play f3 tone(10, 174.61, 300); delay(400); // play c4 tone(10, 261.63, 300); delay(400); // play b3 tone(10, 246.94, 300); delay(400); // play a3 tone(10, 220, 900); delay(1000); // play b3 tone(10,246.94, 300); delay(400); // play c4 tone(10, 261.63, 300); delay(400); // play d4 tone(10, 293.66, 300); delay(400); // play e4 tone(10, 329.63, 900); delay(1000); // play g3 tone(10, 196, 300); delay(400); // play f4 tone(10, 349.23, 300); delay(400); //play e4 tone(10, 329.23, 300); delay(400); // play d4 tone(10, 293.63, 900); delay(1000); // play e3 tone(10,164.81, 300); delay(400); // play e4 tone(10, 329.63, 300); delay(400); // play d4 tone(10, 293.63, 300); delay(400); // play c4 tone(10, 261.63, 900); delay(1000); // play d3 tone(10, 146.83, 300); delay(400); // play d4 tone(10, 293.63, 300); delay(400); // play c4 tone(10, 261.63, 300); delay(400); // play b3 tone(10, 246.94, 900); delay(1000); delay(400); // play e4 tone(10, 329.63, 300); delay(400); // play d4# tone(10, 311.13, 300); delay(350); // play e4 tone( 10, 329.63, 300); delay(350); // play d4# tone( 10,311.13, 300); delay(350); // play e4 tone(10, 329.63, 300); delay(350); // play b3 tone( 10, 246.94, 300); delay(400); // play d4 tone(10, 293.66,300); delay(400); // play c4 tone(10, 261.63,300); delay(400); // play a3 tone(10, 220, 900); delay(1000); // play d3 tone(10,146.83, 300); delay(350); //play f3 tone(10, 174.61, 300); delay(400); //play a3 tone(10, 220, 300); delay(400); // play b3 tone(10, 246.94, 900); delay(1000); // play f3 tone(10, 174.61, 300); delay(400); // play a3 tone(10, 233.08, 300); delay(400); // play b3 tone(10, 246.94, 300); delay(400); // play c4 tone(10, 261.63, 900); delay(1000); delay(300); // play e4 tone(10, 329.63, 300); delay(400); // play d4# tone(10, 311.13, 300); delay(400); // play e4 tone(10, 329.63, 300); delay(400); // play d4# tone(10, 311.13, 300); delay(400); // play e4 tone(10, 329.63, 300); delay(400); // play b3 tone(10, 246.94, 300); delay(400); // play d4 tone(10, 293.66, 300); delay(400); // play c4 tone(10, 261.63, 300); delay(400); // play a3 tone(10, 220, 900); delay(1000); // play d3 tone(10, 146.83, 300); delay(400); // play f3 tone(10, 174.61, 300); delay(400); // play a3 tone(10, 220, 300); delay(400); // play b3 tone(10, 246.94, 900); delay(1000); // play f3 tone(10, 174.61, 300); delay(400); // play c4 tone(10, 261.63, 300); delay(400); // play b3 tone(10, 246.94, 300); delay(400); // play a3 tone(10, 220, 900); delay(1000); delay(5000); } Download 0.71 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling