We can control any of your electronic devices with your smart phone, Even we can control a robot or any other special electronic equipment with our smart phone , Here is a simple tutorial for interfacing an Android Smartphone with Arduino via Bluetooth
Required Materials
Hardware
- Bluetooth Module HC 05/06
- Arduino & Battery (with cable)
- LED
- 220Ω Resistor
- Android device
Software
- Arduino IDE
- Bluetooth electronics
Arduino Code
char data = 0; //Variable for storing received data
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
}
void loop()
{
if(Serial.available()) // Check if data available in serial port
{
data = Serial.read(); //Read the incoming data and store it into variable data
if(data == 'a') //Checks whether value of data is equal to 1
{
digitalWrite(13, HIGH); //If value is 1 then LED turns ON
}
else if(data == 'b') //Checks whether value of data is equal to 0
{
digitalWrite(13, LOW); //If value is 0 then LED turns OFF
}
}
}
Download Arduino code From here
No comments:
Post a Comment