Mundarija: Kirish Asosiy qism Xulosa Kirish
Download 73.7 Kb.
|
Sayidov Sanjar Diplom oldi hisoboti
Salom hammagaBu kodlar “Google” yoki “Opera” “Mazela Fox”lar orqali ko’rish mumkin. Bizda shunaqa natija ko’rinadi.
Modulning Ground va VCC pinlari mos ravishda Arduino platasidagi Ground va 5 voltli pinlarga hamda trig va echo pinlari Arduino platasidagi istalgan raqamli kiritish/chiqarish piniga ulanishi kerak HC-SR04 masofa sensorini Arduino UNO platasiga ulash sxemasi Dastur kodi; const int TRIG = 11; const int ECHO = 10; long duration; int distance; void setup() { \pinMode(TRIG, OUTPUT); Serial.begin(9600); } void loop() { digitalWrite(TRIG, LOW); delay(2); digitalWrite(TRIG, HIGH); delay(10); digitalWrite(TRIG, LOW); duration = pulseIn(ECHO, HIGH); distance = duration * 0.034 / 2; Serial.print("Distance: "); Serial.println(distance); } Natijani ko’rishimiz mumkun. Download 73.7 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling