Arduino Arduino ile Ses Kontrollü Ollie Benzeri Araç Çalışması By Konuk Yazar Posted on 10 Haziran 2015 15 min read 37 1 18,199 Paylaş ! Facebook Paylaş ! Twitter Paylaş ! Google+ Paylaş ! Reddit Paylaş ! Pinterest Paylaş ! Linkedin Paylaş ! Tumblr Merhaba arkadaşlar, Arduino ile Android işbirliğiyle geliştirilen,ses kontrollü araç çalışmasıyla tekrar karşınızdayız.Normal fiyatı 300-400 lira olan Ollie aracını kendi disiplininize göre geliştirebilirsiniz.İlk olarak vidyoyu izleyerek,proje hakkında bilgi sahibi olabilirsiniz. Kullanılan Malzemeler –Arduino uno R3 –HC05 Bluetooth modül –L298N çift motor sürücü karti –2 adet reduktorlü dc motor 200rpm –2 adet usb soket –2 adet anahtar –bc 237 npn transistör –20 adet smd rgb led -2 adet 18650 Li-Ion batarya -Delikli bakirli plaket –2 adetPololu 90x10mm Tekerlek Kullanılan Android Programı -AMR_voice Devre Şeması Yapım Aşamasından Resimler Arduino Kodları #include <SoftwareSerial.h> SoftwareSerial BT(0, 1); //bt giriş String voice; void setup() { BT.begin(9600); Serial.begin(9600); pinMode(3, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(2, OUTPUT); pinMode(4, OUTPUT); pinMode(7, OUTPUT); } //-----------------------------------------------------------------------// void loop() { while (BT.available()){ delay(1); char c = BT.read(); if (c == '#') {break;} voice += c; } if (voice.length() > 0) { Serial.println(voice); //----------------- ıleri git komudu----------------------------// if(voice == "*düz ilerle") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*düz git") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*ilerle") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*düz devam") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*bas gaza") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*yola devam") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*git") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*oğlum bak git") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*tam ileri") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*düz ileri") { analogWrite(5, 30); analogWrite(6, 30); analogWrite(3, 0); analogWrite(9, 0); delay(1); } //-------- sure ile yonlendırme(ileri)---------// if(voice == "*bir saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(1000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*iki saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(2000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*üç saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(3000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*dört saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(4000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*beş saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(5000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*1 saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(1000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*2 saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(2000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*3 saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(3000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*4 saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(4000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } if(voice == "*5 saniye ileri git") { analogWrite(3, 0); analogWrite(9, 0); analogWrite(5, 30); analogWrite(6, 30); delay(5000); analogWrite(5, 0); analogWrite(6, 0); delay(1); } //----- sure ıle yonlendırme(geri)------// if(voice == "*bir saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*iki saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(2000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*üç saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(3000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*dört saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(4000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*beş saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(5000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*1 saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*2 saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(2000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*3 saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(3000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*4 saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(4000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*5 saniye geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(5000); analogWrite(3, 0); analogWrite(9, 0); delay(1); } //--------------------------------- geri gel komudu--------------// if(voice == "*geri gel") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*geri git") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*geri bas") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*tam gel") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*dur gel") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*topla gel") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*geri kaç") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*geri") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 30); analogWrite(9, 30); delay(1); } if(voice == "*dur") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 0); analogWrite(9, 0); delay(1); } if(voice == "*beklemede kal") { analogWrite(5, 0); analogWrite(6, 0); analogWrite(3, 0); analogWrite(9, 0); analogWrite(10, 0); analogWrite(11, 0); digitalWrite(12, LOW); delay(1); } if(voice == "*kırmızı yansın") { digitalWrite(12, HIGH); analogWrite(11, 0); analogWrite(10, 0); delay(1); } if(voice == "*mavi yansın") { digitalWrite(12, LOW); analogWrite(11, 255); analogWrite(10, 0); delay(1); } if(voice == "*yeşil yansın") { digitalWrite(12, LOW); analogWrite(11, 0); analogWrite(10, 255); delay(1); } if(voice == "*mor yansın") { digitalWrite(12, HIGH); analogWrite(11, 255); analogWrite(10, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 10") { analogWrite(5, 30); analogWrite(9, 30); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 20") { analogWrite(5, 53); analogWrite(9, 53); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 30") { analogWrite(5, 76); analogWrite(9, 76); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 40") { analogWrite(5, 99); analogWrite(9, 99); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 50") { analogWrite(5, 122); analogWrite(9, 122); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 60") { analogWrite(5, 145); analogWrite(9, 145); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 70") { analogWrite(5, 168); analogWrite(9, 168); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 80") { analogWrite(5, 191); analogWrite(9, 191); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 90") { analogWrite(5, 214); analogWrite(9, 214); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde 100") { analogWrite(5, 255); analogWrite(9, 255); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde on") { analogWrite(5, 30); analogWrite(9, 30); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde yirmi") { analogWrite(5, 53); analogWrite(9, 53); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde otuz") { analogWrite(5, 76); analogWrite(9, 76); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde kırk") { analogWrite(5, 99); analogWrite(9, 99); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde elli") { analogWrite(5, 122); analogWrite(9, 122); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde atmış") { analogWrite(5, 145); analogWrite(9, 145); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde yetmiş") { analogWrite(5, 168); analogWrite(9, 168); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde seksen") { analogWrite(5, 191); analogWrite(9, 191); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde doksan") { analogWrite(5, 214); analogWrite(9, 214); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kendi ekseni etrafında yüzde yüz") { analogWrite(5, 255); analogWrite(9, 255); analogWrite(3, 0); analogWrite(6, 0); delay(1); } if(voice == "*kafana göre takıl") { analogWrite(10,255); analogWrite(3,255); analogWrite(6,255); delay(2000); analogWrite(3,0); analogWrite(6,0); analogWrite(10,0); delay(200); analogWrite(11,255); analogWrite(5,255); analogWrite(9,255); delay(2000); analogWrite(11,0); analogWrite(5,0); analogWrite(9,0); delay(200); digitalWrite(12,HIGH); analogWrite(3,255); analogWrite(6,255); delay(2000); analogWrite(3,0); analogWrite(6,0); digitalWrite(12,LOW); delay(200); digitalWrite(12,HIGH); analogWrite(11,255); analogWrite(5,255); analogWrite(9,255); delay(2000); analogWrite(11,0); analogWrite(5,0); analogWrite(9,0); digitalWrite(12,LOW); delay(200); analogWrite(11,255); analogWrite(10,255); analogWrite(3,255); analogWrite(6,255); delay(2000); analogWrite(11,0); analogWrite(10,0); analogWrite(3,0); analogWrite(6,0); digitalWrite(12,LOW); delay(200); //----// analogWrite(5,255); analogWrite(9,255); digitalWrite(12,HIGH); delay(500); digitalWrite(12,LOW); delay(1); analogWrite(11,255); delay(500); analogWrite(11,0); delay(1); analogWrite(10,255); delay(500); analogWrite(10,0); delay(1); analogWrite(10,255); analogWrite(11,255); delay(500); analogWrite(10,0); analogWrite(11,0); delay(1); digitalWrite(12,HIGH); analogWrite(11,255); delay(500); digitalWrite(12,LOW); analogWrite(11,0); delay(1); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(10,110); analogWrite(11,250); //----// analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(5,255); analogWrite(9,255); delay(20); analogWrite(5,0); analogWrite(9,0); delay(200); analogWrite(10,0); analogWrite(11,0); delay(1); } if(voice == "*ileri git geri gel") { analogWrite(5,30); analogWrite(6,30); delay(4000); analogWrite(5,30); analogWrite(6,0); delay(1750); analogWrite(5,30); analogWrite(6,30); delay(4000); analogWrite(5,0); analogWrite(6,0); } if(voice == "*dikdörtgen") { analogWrite(5,30); analogWrite(6,30); delay(1500); analogWrite(5,30); analogWrite(6,0); delay(830); //1. 90 donuş// analogWrite(5,30); analogWrite(6,30); delay(1500); analogWrite(5,30); analogWrite(6,0); delay(830); // 2.denuş // analogWrite(5,30); analogWrite(6,30); delay(1500); analogWrite(5,30); //3. denus// analogWrite(6,0); delay(830); analogWrite(5,30); analogWrite(6,30); delay(1500); analogWrite(5,0); analogWrite(6,0); } if(voice == "*daire çiz") { analogWrite(5,30); analogWrite(6,0); delay(1000); analogWrite(5,60); analogWrite(6,0); delay(500); analogWrite(5,90); analogWrite(6,0); delay(500); analogWrite(5,120); analogWrite(6,0); delay(500); analogWrite(5,120); analogWrite(6,30); delay(500); analogWrite(5,150); analogWrite(6,40); delay(500); analogWrite(5,180); analogWrite(6,50); delay(500); analogWrite(5,220); analogWrite(6,60); delay(500); analogWrite(5,240); analogWrite(6,65); delay(500); analogWrite(5,255); analogWrite(6,70); delay(20000); analogWrite(5,240); analogWrite(6,65); delay(500); analogWrite(5,220); analogWrite(6,60); delay(500); analogWrite(5,180); analogWrite(6,50); delay(500); analogWrite(5,150); analogWrite(6,40); delay(500); analogWrite(5,120); analogWrite(6,0); delay(500); analogWrite(5,90); analogWrite(6,0); delay(500); analogWrite(5,60); analogWrite(6,0); delay(500); analogWrite(5,30); analogWrite(6,0); delay(500); analogWrite(5,20); analogWrite(6,0); delay(500); analogWrite(5,0); analogWrite(6,0); } voice="";}}