Loyihalashga


ARDUINO PLATFORMASIDAGI LOYIHALAR


Download 59.04 Kb.
bet6/7
Sana07.01.2023
Hajmi59.04 Kb.
#1081801
1   2   3   4   5   6   7
Bog'liq
Aqlli mashina to’siqqa yetganda to’xtash dasturi va loyihasini y (1)

ARDUINO PLATFORMASIDAGI LOYIHALAR




3.1. Aqlli mashina to’siqqa yetganda to’xtash dasturi


Aqlli mashina loyihasini amalga oshirish uchun biz birinchi navbatda kerakli jixozlarni tayyorlab olamiz. Aqlli mashinamiz nimalardan iborat bo’ladi va u qanday yasaladi? Demak, biz mashina maketini tayyorlab olamiz. So’ng unga 4 ta mator o’rnatamiz va bu mator uchlariga balonchalarni joylashtirib chiqamiz. Matorlarimiz yasayotgan mashinamizni oyoqchalarini va uni harakatlanishini ya’ni yurishini ta’minlaydi. Shulardan keyin biz infra qizil nur datchigini joylashtiramiz. Bu datchigimiz mashinamizni masofadan turib ishchi holatga keltirishni ya’ni ishga tushurishni ta’minlaydi. So’ng ultra zvuk qurilmamizni mashinamizning 4 ta tarafiga joylashtirib chiqamiz. Bu esa mashinamizni to’siqqa urilmasligi, avtahalokat yoki shunga o’xshash nojoya holatlardan asrashini ta’minlaydi. Shunlar bilan aqlli mashinamiz tayyor ishchi holatiga keladi.


Aqlli mashina loyihasi


Infra qizil nur, mator, ultra zvuk, pult yordamida aqlli mashina dasturi. #include "Ultrasonic.h"


#include

int INFRAQ_PIN = 11; // define input pin on Arduino IRrecv irrecv (INFRAQ_PIN);


decode_results qiymat; int q=0;
Ultrasonic ultrasonic(12, 13); void setup () {
Serial.begin (9600);

irrecv.enableIRIn ();


pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(7,OUTPUT); } void loop () {
float masofa = ultrasonic.Ranging(CM); if(masofa<=30) { Serial.println("To'qqacha masofa"); Serial.println("sm"); Serial.println(masofa); } q=qiymat.value;
if (irrecv.decode (& qiymat))

{ Serial.println(q); if(masofa>=20) {


if(q==23205)//Chapga { digitalWrite(4,LOW); digitalWrite(7,LOW); digitalWrite(3,HIGH); delay(80); digitalWrite(3,LOW); }
if(q==4335)//O'nga { digitalWrite(7,LOW); digitalWrite(3,LOW); digitalWrite(4,HIGH); delay(80); digitalWrite(4,LOW); } if(q==19125) //orqaga { digitalWrite(5,LOW); digitalWrite(6,HIGH); digitalWrite(7,HIGH); } if(q==6375) //Oldinga { digitalWrite(7,LOW); digitalWrite(6,LOW); digitalWrite(5,HIGH); }} if(q==14535)//to'htash { digitalWrite(3,LOW); digitalWrite(4,LOW); digitalWrite(5,LOW); digitalWrite(6,LOW); digitalWrite(7,LOW); }}
if(masofa<20)//to'siqni o'ng tomondan aylanib o'tishi {

digitalWrite(7,LOW);


digitalWrite(3,LOW); digitalWrite(4,LOW); digitalWrite(5,LOW); digitalWrite(6,HIGH); delay(5); digitalWrite(6,LOW); digitalWrite(4,LOW); digitalWrite(7,LOW); digitalWrite(3,HIGH); delay(80); digitalWrite(3,LOW); digitalWrite(5,HIGH); delay(200); digitalWrite(5,LOW); digitalWrite(4,HIGH); delay(80); digitalWrite(4,LOW); digitalWrite(5,HIGH); delay(200); digitalWrite(5,LOW); }}

3-rasm: Aqlli mashina loyihasining maket chizmasi





  1. Download 59.04 Kb.

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




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