Arduino and Android Bluetooth Sample Project

i share this project for students and hobbyist in able to help them in their project..
basically the project was made in Java Eclipse "Android" and "Basic" but i
provide the codes for Arduino which you will see below.. btw i used an old
phone which is LG-E405 in this project..

here's the link for the rest of the codes in Android, you will find it below the video..

https://www.youtube.com/watch?v=KYuqVhOLVqc
char incomingByte;  // incoming data
int  LED1 = 12;      // LED pin
int  LED2 = 11;
int  LED3 = 10;
int  LED4 = 9;
int  LED5 = 8;


void setup() {
  Serial.begin(38400); // initialization
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  
}

void loop() {
  if (Serial.available() > 0) {  // if the data came
    incomingByte = Serial.read(); // read byte
    if(incomingByte == 'a') {
       digitalWrite(LED1, HIGH);  // if 1, switch LED Off
    }
    if(incomingByte == 'b') {
       digitalWrite(LED1, LOW); // if 0, switch LED on
    }   
    if(incomingByte == 'c') {
       digitalWrite(LED2, HIGH); // if 0, switch LED on
    }   
    if(incomingByte == 'd') {
       digitalWrite(LED2, LOW); // if 0, switch LED on
    }   
   if(incomingByte == 'e') {
       digitalWrite(LED3, HIGH); // if 0, switch LED on
    }
   if(incomingByte == 'f') {
       digitalWrite(LED3, LOW); // if 0, switch LED on
    }       
    if(incomingByte == 'g') {
       digitalWrite(LED4, HIGH); // if 0, switch LED on
    }   
   if(incomingByte == 'h') {
       digitalWrite(LED4, LOW); // if 0, switch LED on
       Serial.println("LED ON. Press 0 to LED OFF!");
    }  
   if(incomingByte == 'i') {
       digitalWrite(LED5, HIGH); // if 0, switch LED on
    }  
  if(incomingByte == 'j') {
       digitalWrite(LED5, LOW); // if 0, switch LED on
  }
  }
}

thanks :slight_smile:

Programs.zip (1.02 MB)