Prxomity Sensor for Arduino – Use Mobile Proximity Sensor for Arduino using Usb Cable ( Serial Communication )

Proximity sensor is a distance sensor that detect objects without any physical contact . In this App the sensor output is represented by one and zero .
When sensor detect any object it’ll transfer ‘1’ to arduino otherwise it’ll send ‘0’ to arduino.Using combinations of one and zero we can control every thing we want from transducers to home appliances.
App Name : Proxiduino
App Link : https://play.google.com/store/apps/details?id=plutoapps.lightsensors
Algorithm that can be used on the arduino side is that continuously check whether char ‘1’ is recieved or char ‘0’ is recieved if char ‘1’ is recieved it means that sensor has output HIGH now do what you want to do with it and vice verse .
Arduino is one of the most famous microcontroller. This app let you control of arduino from android phone .
Surely otg has several advantages over bluetooth .
1. It is cheap
2. Easy to connect
3. small size
4. Durable
Demo Project :

Arduino Code :

char x;
void setup() {
// put your setup code here, to run once:
pinMode(13,OUTPUT); // Led 1
pinMode(12,OUTPUT); // Led 2
pinMode(11,OUTPUT); // Led 3
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()){
x=Serial.read();
if(x=='1'){
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
}else if(x=='0'){
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
}
}
}

You May Also Like

About the Author: quzal

Leave a Reply

Your email address will not be published. Required fields are marked *