Git Product home page Git Product logo

bluetooth-switches-demo-app's Introduction

Bluetooth Switches Demo App

This is a basic Arduino Demo project for my Android app in Play Store. Bluetooth Switches: Arduino 26 Relay Controller The aim is to explain how to interact with the app

Video of the project

Youtube Video

How to get it working

  1. First Upload this Code to Arduino

    char ch;
    int LED_1 = 3;
    int LED_2 = 4;
    int LED_3 = 5;
    int LED_4 = 6;
    int LED_5 = 7;
    int LED_6 = 8;
    int LED_7 = 9;
    int LED_8 = 10;
    int LED_9 = 11;
    int LED_10 = 12;
    
    
    
    void setup() {
      // put your setup code here, to run once:
     Serial.begin(9600);
     pinMode(LED_1,OUTPUT);
     pinMode(LED_2,OUTPUT);
     pinMode(LED_3,OUTPUT);
     pinMode(LED_4,OUTPUT);
     pinMode(LED_5,OUTPUT);
     pinMode(LED_6,OUTPUT);
     pinMode(LED_7,OUTPUT);
     pinMode(LED_8,OUTPUT);
     pinMode(LED_9,OUTPUT);
     pinMode(LED_10,OUTPUT);
    
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    if(Serial.available()){
        ch = Serial.read();
        Serial.write(ch);
        doWork(ch);
      }
    }
    
    void doWork(char ch){
      switch(ch){
        case 'A': //code for switch 1 turned on
                  digitalWrite(LED_1,HIGH);
                  break;
        case 'a': //code for switch 1 turned off
                  digitalWrite(LED_1,LOW);
                  break;
        case 'B': //code for switch 2 turned on
                  digitalWrite(LED_2,HIGH);
                  break;
        case 'b': //code for switch 2 turned off
                  digitalWrite(LED_2,LOW);
                  break;
        case 'C': //code for switch 3 turned on
                  digitalWrite(LED_3,HIGH);
                  break;
        case 'c': //code for switch 3 turned off
                  digitalWrite(LED_3,LOW);
                  break;
        case 'D': //code for switch 4 turned on
                  digitalWrite(LED_4,HIGH);
                  break;
        case 'd': //code for switch 4 turned off
                  digitalWrite(LED_4,LOW);
                  break;      
        case 'E': //code for switch 5 turned on
                  digitalWrite(LED_5,HIGH);
                  break;
        case 'e': //code for switch 5 turned off
                  digitalWrite(LED_5,LOW);
                  break;
        case 'F': //code for switch 6 turned on
                  digitalWrite(LED_6,HIGH);
                  break;
       case 'f':  //code for switch 6 turned off
                  digitalWrite(LED_6,LOW);
                  break;
       case 'G':  //code for switch 7 turned on
                  digitalWrite(LED_7,HIGH);
                  break;
       case 'g':  //code for switch 7 turned off
                  digitalWrite(LED_7,LOW);
                  break;
       case 'H':  //code for switch 8 turned on
                  digitalWrite(LED_8,HIGH);
                  break;
       case 'h':  //code for switch 8 turned off
                  digitalWrite(LED_8,LOW);
                  break;
       case 'I':  //code for switch 9 turned on
                  digitalWrite(LED_9,HIGH);
                  break;
        case 'i': //code for switch 9 turned off
                  digitalWrite(LED_9,LOW);
                  break;
       case 'J':  //code for switch 10 turned on
                  digitalWrite(LED_10,HIGH);
                  break;
       case 'j':  //code for switch 10 turned off
                  digitalWrite(LED_10,LOW);
                  break;
       // Similarly for others
      }
    }
  2. Then make the circuit as shown here

    Circuit Diagram

    Don't connect HC 05 when you are uploading code to Arduino as you may get errors

  3. Pair the module with your phone

    The pairing code will be 1234 or 0000

  4. Download and Use the App

    Play Store Link

bluetooth-switches-demo-app's People

Contributors

yashx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.