Sathyajith Lakshan
Published

Bluetooth Control LED

Control LED via bluetooth Technology, using

BeginnerProtip143
Bluetooth Control LED

Things used in this project

Story

Read more

Schematics

Diagram

Code

Arduino Code

Arduino
#include<SoftwareSerial.h>
SoftwareSerial bluetooth(1,3); //TX,RX
int led1=4;
int led2=3;
int led3=5;
void setup() {
 pinMode(led1,OUTPUT);
 pinMode(led2,OUTPUT);
 pinMode(led3,OUTPUT);
 bluetooth.begin(9600);

}

void loop() {
  if(bluetooth.available()){
    int i=bluetooth.read();
    if(i=='1'){
      digitalWrite(led1,HIGH);
    }
    if(i=='2'){
      digitalWrite(led1,LOW);
    }
    if(i=='3'){
      digitalWrite(led2,HIGH);
    }
    if(i=='4'){
      digitalWrite(led2,LOW);
    }
    if(i=='5'){
      digitalWrite(led3,HIGH);
    }
    if(i=='6'){
      digitalWrite(led3,LOW);
    }
  }

}

Credits

Sathyajith Lakshan
3 projects • 1 follower
I am a student, absolutely crazy about electronics, IOT
Contact

Comments

Please log in or sign up to comment.