Pages: [1]   Go Down
Author Topic: i want to have the status of my pins on my android phone using bluetooth  (Read 505 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i am using arduino , android phone , and bluetooth..
i have 2 pins .. i need to turn them on or off .. but the problem is that i need to get the status first of those 2 pins .
for example if pin 1 is on , so there is no need to turn it on ...
i need a program that checks the status of my pins  .. and when it check, it must give me a feed back on my ON and OFF pins.. please help me ..
Logged

California
Offline Offline
Faraday Member
**
Karma: 91
Posts: 3429
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What have you tried?
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 175
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you must use digitalRead(pin) and after send this state to bluetooth with serial.
 
Code:
int val = 0;     // variable to store the read value
int ledPin=13; //Indicator led. If pin 2 or 3 is HIGH red led on.
//We check the pins 2,3.....you can change it....

void setup()
{
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
  pinMode(2, INPUT);      // sets the digital pin 2 as input
  pinMode(3, INPUT);      // sets the digital pin 3 as input
}

void loop(){
for(int i=2;i<4;i++){
     val = digitalRead(i);
if ( val==HIGH ) {
           Serial.print(i);//Send to bluetooth HIGH pin
           delay(100);
           digitalWrite(ledPin,HIGH); //If pin 2 or pin 3 is HIGH the LED 13 on for 1 secs
           delay(1000);
           digitalWrite(ledPin,LOW);
      }
} else {
    digitalWrite(ledPin, LOW);  // turn LED OFF
    }
  }
}

 You must see in your android screen the HIGH pins...
« Last Edit: May 25, 2013, 10:25:29 am by power7net » Logged

Web / sms / bluetooth / arduino / android remote control. Home Automation projects.
http://www.power7.net

Pages: [1]   Go Up
Jump to: