Arduino Code-
int m1 = 12;
int m2 = 11;
int b1 = 10;
int b2 = 9;
int left = 8;
int right = 7;
int up = 6;
int down = 5;
int light= 13;
String readString;
void setup() {
Serial.begin(9600);
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);
pinMode(b1, OUTPUT);
pinMode(b2, OUTPUT);
pinMode(left, OUTPUT);
pinMode(right, OUTPUT);
pinMode(up, OUTPUT);
pinMode(down, OUTPUT);
pinMode(light, OUTPUT);
}
void loop() {
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
if (readString == "f")
{
digitalWrite(m1, HIGH);
digitalWrite(m2, HIGH);
}
if (readString == "b")
{
digitalWrite(b1, HIGH);
digitalWrite(b2, HIGH);
}
if (readString == "l")
{
digitalWrite(m1, HIGH);
digitalWrite(b2, HIGH);
}
if (readString == "r")
{
digitalWrite(m2, HIGH);
digitalWrite(b1, HIGH);
}
if (readString == "s")
{
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(b1, LOW);
digitalWrite(b2, LOW);
digitalWrite(left, LOW);
digitalWrite(right, LOW);
digitalWrite(up, LOW);
digitalWrite(down, LOW);
}
if (readString == "ledon")
{
digitalWrite(light, HIGH);
}
if (readString == "ledoff")
{
digitalWrite(light, LOW);
}
if (readString == "left")
{
digitalWrite(left, HIGH);
}
if (readString == "right")
{
digitalWrite(right, HIGH);
}
if (readString == "up")
{
digitalWrite(up, HIGH);
}
if (readString == "down")
{
digitalWrite(down, HIGH);
}
readString="";
}
}
This version of Arduino bluetooth car plus Android App comes with one universal variant which will work on all the Android devices.
If you are looking to download other versions of Arduino bluetooth car plus Android App, We have 1 version in our database. Please select one of them below to download.