Arduino Arduino ile Bluetooth Kontrollü Ollie Benzeri Araç Çalışması 2 By Konuk Yazar Posted on 19 Haziran 2015 8 min read 29 0 11,834 Paylaş ! Facebook Paylaş ! Twitter Paylaş ! Google+ Paylaş ! Reddit Paylaş ! Pinterest Paylaş ! Linkedin Paylaş ! Tumblr Merhaba arkadaşlar, Daha önce,Arduino ile ses kontrollü Ollie benzeri araç çalışmasını sizlerle paylaşmıştık.Bu çalışmaya buradan ulaşabilirsiniz.Bu çalışmamızda ise,aracımızı telefonumuzdan manuel kontrol edeceğiz.Daha önceki çalışmamızda kullanılan malzemeler,devre şeması aynıdır.İsterseniz biz yine hatırlayalım. 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ı -Daha önceki çalışmamızda,AMR_voice Android programını kullanmıştık.Bu çalışmada,yine marketten indirebiliceğiniz robo remo Android programını kullanacağız. Devre Şeması Projenin Vidyosu Vidoyu önceki çalışmamızda da paylaşmıştık.Bu vidyoda ses ve manuel kontrolü birliktedir.Vidyonun 2,42 saniyesine kadar ses ile kontrol ediliyor.Bu saniyeden sonra manuel kontrolü gerçekleşmektedir. Projenin Yapım Aşamasından Kesitler Manuel Kontrol ve Şarj Aşaması A0 girisimden almis oldugumuz analog degerden batarya yüzdesi an itibariyle görülebilir.Ayrıca resimde gördüğümüz gibi araç üzerinde data ve şarj için 2 tane usb girişi var.Bu sayede hem aracımızı şarj edebiliriz hem de istediğimiz programımızı geliştirip aracımıza yükleyebiliriz. Aydınlatma 6 adet smd rgb led ile yapilmis modül bu sayede istediginiz her rengi alabilirsiniz. Yapım Karşılaşılan Zorluklar Arduino ile manuel kontrollü Ollie araç çalışmasının kodları aşağıda gösterilmektedir. [php] int pil; int led1 = 2; int led2 = 4; int led3 = 7; void setup() { pinMode(A0,INPUT); pinMode(3,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(9,OUTPUT); pinMode(10,OUTPUT); pinMode(11,OUTPUT); pinMode(12,OUTPUT); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); Serial.begin(9600); delay(1); Serial.begin(9600); } void loop() { int batarya = analogRead(A0); batarya = map(batarya,620,830,0,100); Serial.println(batarya); char c = Serial.read(); if (c ==’2′) { analogWrite(5,52); analogWrite(6,50); delay(10); analogWrite(5,64); analogWrite(6,60); delay(10); analogWrite(5,74); analogWrite(6,70); delay(10); analogWrite(5,84); analogWrite(6,80); delay(10); analogWrite(5,93); analogWrite(6,90); } if (c ==’3′) { analogWrite(5,220); analogWrite(6,0); } if (c ==’1′) { analogWrite(5,0); analogWrite(6,220); } if (c ==’7′) { analogWrite(5,94); analogWrite(6,90); analogWrite(3,0); analogWrite(9,0); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,104); analogWrite(6,100); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,115); analogWrite(6,110); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,125); analogWrite(6,120); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,135); analogWrite(6,130); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,145); analogWrite(6,140); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,155); analogWrite(6,150); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,165); analogWrite(6,160); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,175); analogWrite(6,170); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,185); analogWrite(6,180); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,195); analogWrite(6,190); } if (c ==’8′) //————// { analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,0); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,0); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,0); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,0); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,0); delay(10); //–// analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,50); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,50); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,50); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,50); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,50); delay(10); //———// analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,100); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,100); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,100); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,100); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,100); delay(10); //—-// analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,150); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,150); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,150); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,150); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,150); delay(10); //———-// analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,200); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,200); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,200); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,200); analogWrite(6,255); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,200); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,255); delay(10); } if (c ==’9′) { analogWrite(3,0); analogWrite(9,0); analogWrite(5,225); analogWrite(6,220); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,230); analogWrite(6,225); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,235); analogWrite(6,230); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,245); analogWrite(6,240); delay(10); analogWrite(3,0); analogWrite(9,0); analogWrite(5,255); analogWrite(6,250); delay(10); } if (c ==’5′) { analogWrite(3,0); analogWrite(9,255); analogWrite(5,255); analogWrite(6,0); analogWrite(11,255); digitalWrite(12,HIGH); analogWrite(10,255); } if (c ==’4′) { analogWrite(3,255); analogWrite(9,0); analogWrite(5,0); analogWrite(6,255); analogWrite(11,255); digitalWrite(12,LOW); analogWrite(10,255); } if (c ==’0′) { analogWrite(5,0); analogWrite(6,0); analogWrite(3,0); analogWrite(9,0); } if (c ==’y’)analogWrite(10,255); if (c ==’m’)analogWrite(11,255); if (c ==’k’)digitalWrite(12,HIGH); if (c ==’b’)analogWrite(10,0); if (c ==’d’)analogWrite(11,0); if (c ==’f’)digitalWrite(12,LOW); if (c ==’0′)analogWrite(10,0); if (c ==’0′)analogWrite(11,0); if (c ==’0′)analogWrite(12,0); if (c ==’h’)analogWrite(5,230); if (c ==’h’)analogWrite(9,230); if (c ==’g’)analogWrite(3,25); if (c ==’g’)analogWrite(9,25); if (c ==’g’)analogWrite(5,0); if (c ==’g’)analogWrite(6,0); if (batarya > 67) digitalWrite(led1, HIGH); if (batarya < 67) digitalWrite(led1, LOW); if (batarya < 67) digitalWrite(led2, HIGH); if (batarya > 67) digitalWrite(led2, LOW); if (batarya < 34) // else ıcın kullan digitalWrite(led2, LOW); if (batarya < 34) digitalWrite(led3, HIGH); if (batarya > 34) digitalWrite(led3, LOW); if (batarya < 1) digitalWrite(led3, LOW); Serial.print("batarya%"); delay(1); } [/php]