by iHackRobot on Vimeo.
/* ===============================================================
Project: Android Smartphone with Arduino Bluetooth
Author: J. B. Wylzan
Website: http://www.ihackrobot.blogspot.com
Abstract: How to control an led using smartphone
================================================================== */
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
int ledPin = 12;
char data = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
BTserial.begin(9600);
// Serial.begin(9600);
// serial.println("Hello World");
}
void loop()
{
if (BTserial.available())
{
data = BTserial.read(); //Read incoming value and store it into data
if(data == '1') //when data is equal to 1
digitalWrite(ledPin, HIGH); // then LED is ON
else if(data == '0') //when data is equal to 0
digitalWrite(ledPin, LOW); // then LED is OFF
}
}
Another Version of the Generic Robotics App |
Warning: : If an application is requesting permission to access any information of your phone or tablet, it is your sole own discretion if you provide permission or not. IHackRobot is not affiliated with the contents of the application or even its owner.
Disclaimer: We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website.
"Without the physical world, Ideas will not exist." ~ Joey Lawsin
==================================================================
NOTICE: Articles on this site are composed on random
thoughts. The transcript may not be in its final form. It maybe
edited, updated or even revised in the future based on the outcomes of the author's experiments.
==================================================================
Patent Pending. 2000 © ®
No comments:
Post a Comment