About Arduino Car Control
Arduino circuit check your car from your phone with bluetooth communication .
Arduino bluetooth haberleşmesi ile telefonunuzdan araba devrelerinizi kontrol edin.
ahmetalberen@gmail.com for questions You can send mail .
Sorularınız için ahmetalberen@gmail.com mail atabilirsiniz.
/*
HAZIRLAYAN = Ahmet ALBEREN
ahmetalberen@gmail.co for questions You can send mail .
*/
#include
SoftwareSerial BT(2,3); //rx-tx
int Car1= 5;
int Car2= 6;
int motorlc = 8; // left motor clockwise rotation
int motorla = 9; // left motor anticlockwise rotation
int motorrc = 10; // right motor clockwise rotation
int motorra = 11; // right motor anticlockwise rotatio
int Far = 13;
int hiz1;
int hiz2;
int hiz3;
String readString;
void setup() { // presenting pins as outputs
pinMode(Far, OUTPUT);
pinMode(motorlc, OUTPUT);
pinMode(motorla, OUTPUT);
pinMode(motorrc, OUTPUT);
pinMode(motorra, OUTPUT);
Serial.begin(9600);
BT.begin(9600);
}
void loop() {
while(BT.available()){ // the code here is for bluetooth
delay(3);
char c = BT.read();
readString += c;
}
if(readString.length() > 0){ // when a certain button is pressed the reaction will be...
Serial.println(readString);
if(readString == "Forward"){
analogWrite (Car1,hiz1);
analogWrite (Car2,hiz1);
digitalWrite(motorlc, HIGH);
digitalWrite(motorla, LOW);
digitalWrite(motorrc, HIGH);
digitalWrite(motorra, LOW);
}
if(readString == "Back"){
analogWrite (Car1,hiz1);
analogWrite (Car2,hiz1);
digitalWrite(motorlc, LOW);
digitalWrite(motorla, HIGH);
digitalWrite(motorrc, LOW);
digitalWrite(motorra, HIGH);
}
if(readString == "Left"){
analogWrite (Car1,hiz2);
analogWrite (Car2,hiz2);
digitalWrite(motorlc, HIGH);
digitalWrite(motorla, LOW);
digitalWrite(motorrc, LOW);
digitalWrite(motorra, HIGH);
}
if(readString == "Right"){
analogWrite (Car1,hiz2);
analogWrite (Car2,hiz2);
digitalWrite(motorlc, LOW);
digitalWrite(motorla, HIGH);
digitalWrite(motorrc, HIGH);
digitalWrite(motorra, LOW);
}
if(readString == "Stop"){
digitalWrite(motorlc, LOW);
digitalWrite(motorla, LOW);
digitalWrite(motorrc, LOW);
digitalWrite(motorra, LOW);
analogWrite (Car1,hiz3);
analogWrite (Car2,hiz3);
}
if(readString == "Car on"){
hiz1 =200;
hiz2 =140;
hiz3 =0;
digitalWrite(Far,HIGH);
delay(50);
digitalWrite(Far,LOW);
delay(50);
digitalWrite(Far,HIGH);
delay(50);
digitalWrite(Far,LOW);
delay(50);
digitalWrite(Far,HIGH);
delay(50);
digitalWrite(Far,LOW);
}
if(readString == "Car off"){
hiz1 =0;
hiz2 =0;
hiz3 =0;
}
if(readString == "Far on"){
digitalWrite(Far,HIGH);
}
if(readString == "Far off"){
digitalWrite(Far, LOW);
}
}
readString="";
} Arduino circuit check your car from your phone with the Bluetooth communication.
Arduino circuit check your car from your phone with bluetooth communication.
You can send e-mail questions ahmetalberen@gmail.co fur.
You can take ahmetalberen@gmail.co mail for your questions.
/ *
PREPARING = Ahmet ALBERI the
You can send mail ahmetalberen@gmail.co for questions.
* /
#include
SoftwareSerial CT (2,3); // Rx-tx
car1 int = 5;
car2 int = 6;
motorlc int = 8; // Left engine clockwise rotation
int motor = 9; // Left engine anticlockwise rotation
motorrc int = 10; // Right engine clockwise rotation
Motorride int = 11; // Right engine anticlockwise rotation
Far int = 13;
int SPEED1;
int speed2;
int speed3;
String ReadString;
void setup () {// presenting pins as outputs
In pinmo (Farr, OUTPUT);
In pinmo (motorlc, OUTPUT);
In pinmo (engine, OUTPUT);
In pinmo (motorrc, OUTPUT);
In pinmo (Motorride to OUTPUT);
Serial.beg's (9600);
bt.beg's (9600);
}
void loop () {
while (bt.availabl to ()) {// the code here is for Bluetooth
DeLay (3);
bt.read char c = ();
ReadString + = c;
}
if (readstring.length ()> 0) {// when a certain button is pressed in the reaction will be ...
Serial.println (ReadString);
if (ReadString == "Forward") {
analogwrit A (car1, SPEED1);
analogwrit A (car2, SPEED1);
digitalwrit A (motorlc, HIGH);
digitalwrit the (engine, LOW);
digitalwrit A (motorrc, HIGH);
digitalwrit to (Motorride to LOW);
}
if (ReadString == "Back") {
analogwrit A (car1, SPEED1);
analogwrit A (car2, SPEED1);
digitalwrit A (motorlc, LOW);
digitalwrit the (engine, HIGH);
digitalwrit A (motorrc, LOW);
digitalwrit to (Motorride to, HIGH);
}
if (ReadString == "Left") {
analogwrit A (car1, speed2);
analogwrit A (car2, speed2);
digitalwrit A (motorlc, HIGH);
digitalwrit the (engine, LOW);
digitalwrit A (motorrc, LOW);
digitalwrit to (Motorride to, HIGH);
}
if (ReadString == "Right") {
analogwrit A (car1, speed2);
analogwrit A (car2, speed2);
digitalwrit A (motorlc, LOW);
digitalwrit the (engine, HIGH);
digitalwrit A (motorrc, HIGH);
digitalwrit to (Motorride to LOW);
}
if (ReadString == "Stop") {
digitalwrit A (motorlc, LOW);
digitalwrit the (engine, LOW);
digitalwrit A (motorrc, LOW);
digitalwrit to (Motorride to LOW);
analogwrit A (car1, speed3);
analogwrit A (car2, speed3);
}
if (ReadString == "C on") {
SPEED1 = 200;
speed2 = 140;
speed3 = 0;
digitalwrit (Headlamp, HIGH);
delay (50);
digitalwrit (Headlamp, LOW);
delay (50);
digitalwrit (Headlamp, HIGH);
delay (50);
digitalwrit (Headlamp, LOW);
delay (50);
digitalwrit (Headlamp, HIGH);
delay (50);
digitalwrit (Headlamp, LOW);
}
if (ReadString == "C off") {
SPEED1 = 0;
speed2 = 0;
speed3 = 0;
}
if (ReadString == "Lights on") {
digitalwrit (Headlamp, HIGH);
}
if (ReadString == "Lights off") {
digitalwrit (Headlamp, LOW);
}
}
ReadString = "";
}