Arduino Project #11: Android smartphone Bluetooth control LEDs by Arduino

Arduino Project #11: 

Android smartphone Bluetooth with an Arduino via  to control an LEDs

Android smartphone Bluetooth control  LEDs by Arduino 


http://ai2.appinventor.mit.edu/

This information gives insight into MIT app inventor and what are the requirements need to get started with this video series, anyone watching this video can make their own app and control a LED connected to arduino without any prior experience, if they have components with that's more enough to make this tutorial. Blinking an LED is the first thing we do when we getting started with electronics in this tutorial you will TURN ON and TURN OFF the LED, this is the Hello world example in this tutorial, you don't need any prior coding experience to make this application work. 

Connection Diagram :



To test the app that created during this tutorial, you need an Android mobile or android supported devices to test your app. creating an app with MIT app inventor is very simple, you won't be doing any coding process during creating your app, you will be assembling blocks together to make your app. if you don't have any prior experience with Arduino control, make sure you follow some basics like connecting Arduino to your computer and upload example code to Arduino from Arduino IDE, this would be more sufficient to follow this tutorial. 

Mitappsinventor 2 code : 

http://ai2.appinventor.mit.edu/#5824273083400192








Code : 

--------------------------------------------------------------------------------------------------------------------------

#include <SoftwareSerial.h>

String state;// string to store incoming message from bluetooth

void setup() {

  Serial.begin(9600); // serial communication started

  pinMode(13, OUTPUT); // LED connected to 13th pin



}

//-----------------------------------------------------------------------//  

void loop() {

  while (Serial.available()){  //Check if there is an available byte to read

  delay(10); //Delay added to make thing stable 

  char c = Serial.read(); //Conduct a serial read

  state += c; //build the string- either "On" or "off"

  }  

  if (state.length() > 0) {

    

  if(state == "on") 

  {

    digitalWrite(13, HIGH);

    

      } 

  

  else if(state == "off") 

  {

    digitalWrite(13, LOW);

     }


state ="";} //Reset the variable

}


--------------------------------------------------------------------------------------------------------------------------

 App link: 

https://www.dropbox.com/s/0s3opdz2hd96e7a/Led_bluetooth_switching.apk?dl=0


. aia file: 

https://www.dropbox.com/s/wcksikw7fm1x9jj/Led_bluetooth_switching.aia.zip?dl=0


1 comment:

INSTAGRAM FEED

@soratemplates