Go Down

Topic: i want to have the status of my pins on my android phone using bluetooth (Read 543 times) previous topic - next topic

moeabok

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 ..


I think you must use digitalRead(pin) and after send this state to bluetooth with serial.
Code: [Select]
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...
Web / sms / bluetooth / arduino / android remote control. Home Automation projects.
http://www.power7.net

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy