// code started
// DIY smart glass for blind
// using by ultrasonic sensor
//Created by Technical idEas (yt)
// https://youtube.com/channel/UCCJyR_wnt3SxhErsSUP9Wrw
#define trigPin1 5
#define echoPin1 6
#define motor1 7
#define buzzer1 8
#define trigPin2 9
#define echoPin2 10
#define motor2 11
#define buzzer2 12
long duration, distance, UltraSensor1, UltraSensor2;
char data;
String SerialData="";
void setup()
{
Serial.begin (9600);
pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
pinMode(motor1, OUTPUT);
pinMode(buzzer1, OUTPUT);
pinMode(trigPin2, OUTPUT);
pinMode(echoPin2, INPUT);
pinMode(motor2, OUTPUT);
pinMode(buzzer2, OUTPUT);
digitalWrite(motor1,LOW);
digitalWrite(motor2,LOW);
digitalWrite(buzzer1,LOW);
digitalWrite(buzzer2,LOW);
}
void loop()
{
SonarSensor(trigPin1, echoPin1);
UltraSensor1 = distance;
SonarSensor(trigPin2,echoPin2);
UltraSensor2 = distance;
while(Serial.available())
{
delay(10);
data=Serial.read();
SerialData+=data;
}
if(SerialData=="display distance")
{
Serial.print("distance measured by the first sensor: ");
Serial.print(UltraSensor1);
Serial.println(" cm");
Serial.print("distance measured by the second sensor: ");
Serial.print(UltraSensor2);
Serial.println(" cm");
Serial.println("---------------------------------------------------------------------------------------------------------");
}
SerialData="";
if(UltraSensor1 <=70)
{
digitalWrite(buzzer1,HIGH);
digitalWrite(motor1,HIGH);
}
else
{
digitalWrite(buzzer1,LOW);
digitalWrite(motor1,LOW);
}
if(UltraSensor2 <=70)
{
digitalWrite(buzzer2,HIGH);
digitalWrite(motor2,HIGH);
}
else
{
digitalWrite(buzzer2,LOW);
digitalWrite(motor2,LOW);
}
}
void SonarSensor(int trigPinSensor,int echoPinSensor)
{
digitalWrite(trigPinSensor, LOW);
delayMicroseconds(2);
digitalWrite(trigPinSensor, HIGH);
delayMicroseconds(10);
digitalWrite(trigPinSensor, LOW);
duration = pulseIn(echoPinSensor, HIGH);
distance= (duration/2) / 29.1;
}
10 Comments
Nahi aaa rha h bhai video bhej do please please please please please please please please please please please please please
ReplyDeleteMsg me on instagram
ReplyDeleteHello bhai , ardino nano me maine code upload kiya mobile otg se jab power deta hu ardino nano or buzzer sab kuch acha se kam krta hai.Pr jab 3.7v battery supply deta hu buzzer or vibrator amesha on rhta hai work krta hai kuch b object ko detect kiye bina e awaz krta hai uska upay btaye same apka circuit diagram se bnaya hu. Video:[third eye for blind people.
DeletePls reply
Bahi kya aap mujhe ek clear circuit diagram de sakte ho
ReplyDeleteDiagram me jo likha hai wo clear nahi hai
ReplyDeleteBahi uski jarurat nahi hain mei us diagram Mai click nahi karke dekha tha.
ReplyDeleteEmage ko click karo phir clear ho jayega
DeleteCoding Kaise Apne andar Lu
ReplyDeleteCoding ka kya use hey bhai
ReplyDeleteplaeas this project explane
ReplyDelete